busybox Digest, Vol 45, Issue 14

Guenter lists at gknw.net
Sun Apr 12 15:12:17 UTC 2009


Hi Denys,
Denys Vlasenko schrieb:
> On Friday 10 April 2009 07:53, Guenter wrote:
>> Hi Denys,
>> Denys Vlasenko schrieb:
>>> This is bad. I'd like to have busybox mount a drop-in replacement
>>> to util-linux one. Whenever you have an example of differing
>>> behavior, report it to the list and/or bug database.
>>>
>>> Provide exact command line and also run both
>>> mounts under "strace -f -oLOGFILE mount ..."
>>> and show the logs (or attach them to bug record).
>>>
>>> Bug reports is the only way we can even know you have a problem.
>> sure, I try - but FTM I cant strace because the embedded system boots
>> via PXE, and the initrd image has no space left + I have not strace
>> sources handy to build a version for uClibc.
>>
>> I have though checked a bit more, and now see that mount does indeed
>> plugin the mount.cifs on its own once its sitting in /sbin, and once I
>> have enabled it for busybox :)
>>
>> So now I can reduce the mount command, and the folowing works on Debian
>> kernel 2.4.36 with mount 2.14.2 + mount.cifs 1.5:
>> mount //server/share /mnt/cifs -o user=johndoe
>>
>> same kernel, same mount.cifs but busybox 1.13.3 mount fails with an
>> error about unable to mount DSE root - not supported...
>>
>> so I did replace the mount.cifs helper with a shell script which contains:
>> #/bin/sh
>> echo $*
>> this shows with the above command with Debian mount 2.14.2:
>> //server/share /mnt/cifs -o rw,user=johndoe
>>
>> while with busybox 1.13.3 mount this prints:
>> -o user=johndoe,ip=server \\server\share /mnt/cifs
>>
>> so I did comment the relevant part in mount.c, and changed the order of
>> arguments for the mount.cifs so that the -o options apear last instead
>> if first, and bingo! this makes it work:
>>
>> --- util-linux/mount.c.orig	2009-02-26 12:47:43.000000000 +0100
>> +++ util-linux/mount.c	2009-04-10 07:41:52.000000000 +0200
>> @@ -421,12 +421,12 @@
>>  			int errno_save = errno;
>>  			args[0] = xasprintf("mount.%s", mp->mnt_type);
>>  			rc = 1;
>> +			args[rc++] = mp->mnt_fsname;
>> +			args[rc++] = mp->mnt_dir;
>>  			if (filteropts) {
>>  				args[rc++] = (char *)"-o";
>>  				args[rc++] = filteropts;
>>  			}
>> -			args[rc++] = mp->mnt_fsname;
>> -			args[rc++] = mp->mnt_dir;
>>  			args[rc] = NULL;
>>  			rc = wait4pid(spawn(args));
>>  			free(args[0]);
>> @@ -1622,6 +1622,7 @@
>>  		rc = 1;
>>  		// Replace '/' with '\' and verify that unc points to "//server/share".
>>
>> +/*
>>  		for (s = mp->mnt_fsname; *s; ++s)
>>  			if (*s == '/') *s = '\\';
>>
>> @@ -1639,11 +1640,11 @@
>>  		dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa);
>>  		ip = xasprintf("ip=%s", dotted);
>>  		parse_mount_options(ip, &filteropts);
>> -
>>  		// compose new unc '\\server-ip\share'
>>  		// (s => slash after hostname)
>>
>>  		mp->mnt_fsname = xasprintf("\\\\%s%s", dotted, s);
>> +*/
>>
>> sorry for not attaching the patch (was just a c&p from terminal), but
>> its anyway only a test hack FTM;
>> will investigate a bit further later ...
> 
> Applied, thanks!
uhmm, you really took my crude approach .... :)
well, I would more tend to the attached patch which only removes the
offending ip param + now converts \ to / (just the other way as we did
before); this way we keep the name resolving intact in case its needed.

BTW. I experimented even with adding unc= and that works great with
mount standalone unless you use the mount.cifs helper :)
though when mount.cifs is used it gives a warning about specifying the
unc twice - but mount still works...

greetz, Guen.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mount.diff
Type: text/x-patch
Size: 1989 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090412/218c1b78/attachment.bin>


More information about the busybox mailing list