Weird problem with MDEV as a daemon
Leonid Zhigunov
lzhigunov at qulsar.com
Wed Sep 9 00:02:33 UTC 2020
Hi,
I am using Busybox 1.31.0.
I tried to use MDEV for SD card automounting, but couldn't make it to work.
If mdev.conf entry has a simple command, say, *echo automount, everything
works fine.
As soon as the card is inserted or removed, the command is invoked and
prints "automount".
But if I specify a script file name intead, i.e. */etc/mdev.d/automount,
things get strange.
The sript file has proper permissions. It can be successfully executed from
the command line by
# /etc/mdev.d/automount
# sh /etc/mdev.d/automount
# sh -c /etc/mdev.d/automount
and, provided with proper ACTION and MDEV env variables, it does all things
it suppose to do.
But regardless of script's name, location or contents, whether it has
#!/bin/sh prefix or not,
it doesn't work with MDEV.
What I get is the strange output on the terminal (when #mdev -df) every time
the command is invoked:
: not foundev.d/automount
In the mdev.log is the same:
running: /etc/mdev.d/automount
: not foundev.d/automount
Ok, I added some printfs in the busybox's entry point, to print actual
command line string
busybox is invoked with. The interesting thing is: on every command strating
from the very first init
prints are ok, but from mdev it showed:
h -c /etc/mdev.d/automount, i.e. the first character was missing (or
replaced with space).
So I added argv[0][0] as hex in the beginning, and again everything was ok
for everything
# umount
75 umount
but MDEV:
# mdev -df
3 sh -c /etc/mdev.d/automount (first character is missing, 7)
: not foundev.d/automount
Then I thried to replace system() call in MDEV with how it's done in
ifupdown doit().
I got even funnier result:
# mdev -df
6d mdev -df
f /bin/sh /etc/mdev/automount (first character is missing, 2)
': No such file or directoryev.d/automount
': File existsn '/etc/mdev.d/automount
The last line is actually a somehow overidden string from MDEV's
bb_perror_msg("can't run '%s'", command);
This all makes me think that system() call MDEV is using or nested shell
invocations are not
working as they suppose to and somehow mess up the output.
Has anyone seen something similar?
Is it my-only problem? Did I miss some required settings in the build
configuration?
Any help is much appreciated.
Kind regards,
Leonid
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3864 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20200909/bc4c6603/attachment.bin>
More information about the busybox
mailing list