[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#484799: busybox: mount -f should not mount



Package: busybox
Version: 1:1.9.2-3
Severity: normal


The whole point of mount -f is to write to /etc/mtab I guess, at least
it's how it is sometimes used when the filesystem is mounted by other
means.

As I read the code mount in busybox sets some flag when mtab is used but
ignores the flag when mtab is not used.

It should just (or check that the mount *could* be done if it wants to
do something - like that the files/directories exist).

Attached patch should make bysybox exit when mount -f is used and mtab
is not compiled in.

Thanks


-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.23.3-src (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages busybox depends on:
ii  libc6                         2.7-10     GNU C Library: Shared libraries

busybox recommends no packages.

-- no debconf information
--- util-linux/mount.c~	2008-02-12 17:03:13.000000000 +0100
+++ util-linux/mount.c	2008-06-06 13:57:23.000000000 +0200
@@ -1635,22 +1635,22 @@
 	// Parse remaining options
 
 	opt = getopt32(argv, "o:t:rwanfvsi", &opt_o, &fstype);
+	argv += optind;
+	argc -= optind;
+
+	// Three or more non-option arguments?  Die with a usage message.
+	if (argc > 2) bb_show_usage();
+
 	if (opt & 0x1) append_mount_options(&cmdopts, opt_o); // -o
 	//if (opt & 0x2) // -t
 	if (opt & 0x4) append_mount_options(&cmdopts, "ro"); // -r
 	if (opt & 0x8) append_mount_options(&cmdopts, "rw"); // -w
 	//if (opt & 0x10) // -a
 	if (opt & 0x20) USE_FEATURE_MTAB_SUPPORT(useMtab = 0); // -n
-	if (opt & 0x40) USE_FEATURE_MTAB_SUPPORT(fakeIt = 1); // -f
+	if (opt & 0x40) USE_FEATURE_MTAB_SUPPORT(fakeIt = 1)SKIP_FEATURE_MTAB_SUPPORT(exit(0)); // -f
 	//if (opt & 0x80) // -v: verbose (ignore)
 	//if (opt & 0x100) // -s: sloppy (ignore)
 	//if (opt & 0x200) // -i: don't call mount.<fstype> (ignore)
-	argv += optind;
-	argc -= optind;
-
-	// Three or more non-option arguments?  Die with a usage message.
-
-	if (argc > 2) bb_show_usage();
 
 	// If we have no arguments, show currently mounted filesystems
 

Reply to: