[BusyBox] Re: [BusyBox-cvs] svn commit: trunk/busybox: include networking

Ladislav Michl ladis at linux-mips.org
Fri Jul 29 11:47:50 UTC 2005


On Thu, Jul 28, 2005 at 02:27:10PM -0500, Rob Landley wrote:
> Again, how did the behavior you got differ from what you expected?  Mount 
> operates on device files, not on magic names.  If you specify a relative path 
> and a program turns that into an absolute path by taking the current working 
> directory into account (correctly removing ./ and ../ and // and so on) then 
> where's the harm?  How does passing a relative path or an absolute path to 
> the same file differ in behavior?  (Are you saying we're turning it into the 
> WRONG absolute path?)

First, mount _does_ operate also on "magic" names. You can easily mount
usbfs, tmpfs, sysfs, proc, etc. Now, MTD are not block devices (but there
is block caching layer) and jffs2 operates directly on MTD. Historicaly,
block MTD was only needed to get mount point. Now it is also possible to
specify MTD name, so you do not need to have block device emulation
enabled. You can mount such devices this way:
mount -t jffs2 /dev/mtdblock1 /mnt        [1]
mount -t jffs2 mtd1 /mnt                  [2]
mount -t jffs2 mtd:somename /mnt          [3]
(last example assumes mtd1 is named "somename"). There are following
problems with mount:
* when /dev is working directory mtd1 (in [2]) gets expanded to
  /dev/mtd1 which is _wrong_. Solution is either patch I sent earlier or
  in case you want to 'normalize' device name, just check if it is block
  device (see patch below)
* when support for NFS is enabled [3] will fail, because test for NFS
  share is done by searching ':' in device name.

Index: util-linux/mount.c
===================================================================
--- util-linux/mount.c	(revision 10956)
+++ util-linux/mount.c	(working copy)
@@ -420,7 +420,7 @@
 
 	if (optind < argc) {
 		/* if device is a filename get its real path */
-		if (stat(argv[optind], &statbuf) == 0) {
+		if (stat(argv[optind], &statbuf) == 0 && (S_ISBLK(statbuf.st_mode))) {
 			char *tmp = bb_simplify_path(argv[optind]);
 
 			safe_strncpy(device, tmp, PATH_MAX);



More information about the busybox mailing list