diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-18 16:22:26 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-18 16:22:26 +0200 |
commit | 6ae6426a7485b5835c23aea198b3065f491d918b (patch) | |
tree | 79ebcee570986e27d7137720ca3139af277a162b | |
parent | b71ce023e9527b6afaa497ce62ca53a74cf94cef (diff) | |
download | busybox-w32-6ae6426a7485b5835c23aea198b3065f491d918b.tar.gz busybox-w32-6ae6426a7485b5835c23aea198b3065f491d918b.tar.bz2 busybox-w32-6ae6426a7485b5835c23aea198b3065f491d918b.zip |
fix mountpoint test to not prevemt mkfs_xxx from making image in any file
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | coreutils/df.c | 2 | ||||
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | libbb/find_mount_point.c | 39 | ||||
-rw-r--r-- | testsuite/README | 2 | ||||
-rwxr-xr-x | testsuite/cpio.tests | 2 | ||||
-rwxr-xr-x | testsuite/mount.tests | 5 | ||||
-rwxr-xr-x | testsuite/od.tests | 2 | ||||
-rwxr-xr-x | testsuite/runtest | 14 | ||||
-rwxr-xr-x | testsuite/sed.tests | 18 | ||||
-rwxr-xr-x | testsuite/sort.tests | 7 | ||||
-rwxr-xr-x | testsuite/testing.sh | 16 | ||||
-rw-r--r-- | util-linux/fsck_minix.c | 2 | ||||
-rw-r--r-- | util-linux/mkfs_minix.c | 2 | ||||
-rw-r--r-- | util-linux/mkfs_vfat.c | 2 |
14 files changed, 71 insertions, 44 deletions
diff --git a/coreutils/df.c b/coreutils/df.c index d95aff39d..4bbfe943b 100644 --- a/coreutils/df.c +++ b/coreutils/df.c | |||
@@ -119,7 +119,7 @@ int df_main(int argc, char **argv) | |||
119 | mount_point = *argv++; | 119 | mount_point = *argv++; |
120 | if (!mount_point) | 120 | if (!mount_point) |
121 | break; | 121 | break; |
122 | mount_entry = find_mount_point(mount_point); | 122 | mount_entry = find_mount_point(mount_point, 1); |
123 | if (!mount_entry) { | 123 | if (!mount_entry) { |
124 | bb_error_msg("%s: can't find mount point", mount_point); | 124 | bb_error_msg("%s: can't find mount point", mount_point); |
125 | set_error: | 125 | set_error: |
diff --git a/include/libbb.h b/include/libbb.h index 936d98a23..c7b4de13c 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -995,7 +995,7 @@ extern void run_applet_no_and_exit(int a, char **argv) NORETURN FAST_FUNC; | |||
995 | 995 | ||
996 | #ifdef HAVE_MNTENT_H | 996 | #ifdef HAVE_MNTENT_H |
997 | extern int match_fstype(const struct mntent *mt, const char *fstypes) FAST_FUNC; | 997 | extern int match_fstype(const struct mntent *mt, const char *fstypes) FAST_FUNC; |
998 | extern struct mntent *find_mount_point(const char *name) FAST_FUNC; | 998 | extern struct mntent *find_mount_point(const char *name, int subdir_too) FAST_FUNC; |
999 | #endif | 999 | #endif |
1000 | extern void erase_mtab(const char * name) FAST_FUNC; | 1000 | extern void erase_mtab(const char * name) FAST_FUNC; |
1001 | extern unsigned int tty_baud_to_value(speed_t speed) FAST_FUNC; | 1001 | extern unsigned int tty_baud_to_value(speed_t speed) FAST_FUNC; |
diff --git a/libbb/find_mount_point.c b/libbb/find_mount_point.c index 12b2cfce4..bcb18effe 100644 --- a/libbb/find_mount_point.c +++ b/libbb/find_mount_point.c | |||
@@ -17,27 +17,29 @@ | |||
17 | * Given any other file (or directory), find the mount table entry for its | 17 | * Given any other file (or directory), find the mount table entry for its |
18 | * filesystem. | 18 | * filesystem. |
19 | */ | 19 | */ |
20 | struct mntent* FAST_FUNC find_mount_point(const char *name) | 20 | struct mntent* FAST_FUNC find_mount_point(const char *name, int subdir_too) |
21 | { | 21 | { |
22 | struct stat s; | 22 | struct stat s; |
23 | dev_t mountDevice; | 23 | FILE *mtab_fp; |
24 | FILE *mountTable; | ||
25 | struct mntent *mountEntry; | 24 | struct mntent *mountEntry; |
25 | dev_t devno_of_name; | ||
26 | bool block_dev; | ||
26 | 27 | ||
27 | if (stat(name, &s) != 0) | 28 | if (stat(name, &s) != 0) |
28 | return NULL; | 29 | return NULL; |
29 | 30 | ||
30 | if (S_ISBLK(s.st_mode)) | 31 | devno_of_name = s.st_dev; |
31 | mountDevice = s.st_rdev; | 32 | block_dev = 0; |
32 | else | 33 | if (S_ISBLK(s.st_mode)) { |
33 | mountDevice = s.st_dev; | 34 | devno_of_name = s.st_rdev; |
34 | 35 | block_dev = 1; | |
36 | } | ||
35 | 37 | ||
36 | mountTable = setmntent(bb_path_mtab_file, "r"); | 38 | mtab_fp = setmntent(bb_path_mtab_file, "r"); |
37 | if (!mountTable) | 39 | if (!mtab_fp) |
38 | return 0; | 40 | return NULL; |
39 | 41 | ||
40 | while ((mountEntry = getmntent(mountTable)) != NULL) { | 42 | while ((mountEntry = getmntent(mtab_fp)) != NULL) { |
41 | /* rootfs mount in Linux 2.6 exists always, | 43 | /* rootfs mount in Linux 2.6 exists always, |
42 | * and it makes sense to always ignore it. | 44 | * and it makes sense to always ignore it. |
43 | * Otherwise people can't reference their "real" root! */ | 45 | * Otherwise people can't reference their "real" root! */ |
@@ -49,13 +51,18 @@ struct mntent* FAST_FUNC find_mount_point(const char *name) | |||
49 | ) { /* String match. */ | 51 | ) { /* String match. */ |
50 | break; | 52 | break; |
51 | } | 53 | } |
52 | /* Match the device. */ | 54 | |
53 | if (stat(mountEntry->mnt_fsname, &s) == 0 && s.st_rdev == mountDevice) | 55 | if (!(subdir_too || block_dev)) |
56 | continue; | ||
57 | |||
58 | /* Is device's dev_t == name's dev_t? */ | ||
59 | if (stat(mountEntry->mnt_fsname, &s) == 0 && s.st_rdev == devno_of_name) | ||
54 | break; | 60 | break; |
55 | /* Match the directory's mount point. */ | 61 | /* Match the directory's mount point. */ |
56 | if (stat(mountEntry->mnt_dir, &s) == 0 && s.st_dev == mountDevice) | 62 | if (stat(mountEntry->mnt_dir, &s) == 0 && s.st_dev == devno_of_name) |
57 | break; | 63 | break; |
58 | } | 64 | } |
59 | endmntent(mountTable); | 65 | endmntent(mtab_fp); |
66 | |||
60 | return mountEntry; | 67 | return mountEntry; |
61 | } | 68 | } |
diff --git a/testsuite/README b/testsuite/README index 3c52254dd..03ac377ba 100644 --- a/testsuite/README +++ b/testsuite/README | |||
@@ -27,6 +27,8 @@ For busybox built against uclibc, /etc/TZ does not exist or does not match | |||
27 | host system timezone setting. For glibc based host systems, timezona settings | 27 | host system timezone setting. For glibc based host systems, timezona settings |
28 | are in /etc/localtime. | 28 | are in /etc/localtime. |
29 | 29 | ||
30 | LANG and LC_xxx environment variables set to non-C locale. | ||
31 | |||
30 | 32 | ||
31 | For the entire testsuite, the copyright is as follows: | 33 | For the entire testsuite, the copyright is as follows: |
32 | 34 | ||
diff --git a/testsuite/cpio.tests b/testsuite/cpio.tests index 576180ff1..fa0b65a08 100755 --- a/testsuite/cpio.tests +++ b/testsuite/cpio.tests | |||
@@ -41,6 +41,7 @@ ls -ln cpio.testdir | $FILTER_LS" \ | |||
41 | " \ | 41 | " \ |
42 | "" "" | 42 | "" "" |
43 | 43 | ||
44 | test x"$SKIP_KNOWN_BUGS" = x"" && { | ||
44 | # Currently fails. Numerous buglets: "1 blocks" versus "1 block", | 45 | # Currently fails. Numerous buglets: "1 blocks" versus "1 block", |
45 | # "1 block" must go to stderr, does not list cpio.testdir/x and cpio.testdir/y | 46 | # "1 block" must go to stderr, does not list cpio.testdir/x and cpio.testdir/y |
46 | testing "cpio lists hardlinks" \ | 47 | testing "cpio lists hardlinks" \ |
@@ -53,6 +54,7 @@ cpio.testdir/y | |||
53 | 0 | 54 | 0 |
54 | " \ | 55 | " \ |
55 | "" "" | 56 | "" "" |
57 | } | ||
56 | 58 | ||
57 | # More complex case | 59 | # More complex case |
58 | rm -rf cpio.testdir cpio.testdir2 2>/dev/null | 60 | rm -rf cpio.testdir cpio.testdir2 2>/dev/null |
diff --git a/testsuite/mount.tests b/testsuite/mount.tests index 5374ecbd6..c8381a0de 100755 --- a/testsuite/mount.tests +++ b/testsuite/mount.tests | |||
@@ -1,5 +1,4 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | |||
3 | # Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com> | 2 | # Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com> |
4 | # Licensed under GPL v2, see file LICENSE for details. | 3 | # Licensed under GPL v2, see file LICENSE for details. |
5 | 4 | ||
@@ -10,8 +9,8 @@ test "`id -u`" = 0 || { | |||
10 | exit 0 | 9 | exit 0 |
11 | } | 10 | } |
12 | 11 | ||
13 | dd if=/dev/zero of=mount.image1m count=1 bs=1M 2>/dev/null || exit 1 | 12 | dd if=/dev/zero of=mount.image1m count=1 bs=1M 2>/dev/null || { echo "dd error"; exit 1; } |
14 | mkfs.minix -v mount.image1m >/dev/null 2>&1 || exit 1 | 13 | mkfs.minix -v mount.image1m >/dev/null 2>&1 || { echo "mkfs.minix error"; exit 1; } |
15 | testdir=$PWD/testdir | 14 | testdir=$PWD/testdir |
16 | mkdir $testdir 2>/dev/null | 15 | mkdir $testdir 2>/dev/null |
17 | umount -d $testdir 2>/dev/null | 16 | umount -d $testdir 2>/dev/null |
diff --git a/testsuite/od.tests b/testsuite/od.tests index 69c29952a..f136bb5fa 100755 --- a/testsuite/od.tests +++ b/testsuite/od.tests | |||
@@ -10,7 +10,7 @@ testing "od -b" \ | |||
10 | "od -b" \ | 10 | "od -b" \ |
11 | "\ | 11 | "\ |
12 | 0000000 110 105 114 114 117 | 12 | 0000000 110 105 114 114 117 |
13 | 0000006 | 13 | 0000005 |
14 | " \ | 14 | " \ |
15 | "" "HELLO" | 15 | "" "HELLO" |
16 | 16 | ||
diff --git a/testsuite/runtest b/testsuite/runtest index 5560f7bc2..2428f6c36 100755 --- a/testsuite/runtest +++ b/testsuite/runtest | |||
@@ -1,20 +1,8 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | |||
3 | # Usage: | 2 | # Usage: |
4 | # runtest [applet1] [applet2...] | 3 | # runtest [applet1] [applet2...] |
5 | 4 | ||
6 | # Helper for helpers. Oh my... | 5 | . testing.sh |
7 | test x"$ECHO" != x"" || { | ||
8 | ECHO="echo" | ||
9 | test x"`echo -ne`" = x"" || { | ||
10 | # Compile and use a replacement 'echo' which understands -e -n | ||
11 | ECHO="$PWD/echo-ne" | ||
12 | test -x "$ECHO" || { | ||
13 | gcc -Os -o "$ECHO" ../scripts/echo.c || exit 1 | ||
14 | } | ||
15 | } | ||
16 | export ECHO | ||
17 | } | ||
18 | 6 | ||
19 | # Run one old-style test. | 7 | # Run one old-style test. |
20 | # Tests are stored in applet/testcase shell scripts. | 8 | # Tests are stored in applet/testcase shell scripts. |
diff --git a/testsuite/sed.tests b/testsuite/sed.tests index 677303be1..a9d9ada31 100755 --- a/testsuite/sed.tests +++ b/testsuite/sed.tests | |||
@@ -51,8 +51,10 @@ testing "sed -n" "sed -n -e s/foo/bar/ -e s/bar/baz/" "" "" "foo\n" | |||
51 | testing "sed s//p" "sed -e s/foo/bar/p -e s/bar/baz/p" "bar\nbaz\nbaz\n" \ | 51 | testing "sed s//p" "sed -e s/foo/bar/p -e s/bar/baz/p" "bar\nbaz\nbaz\n" \ |
52 | "" "foo\n" | 52 | "" "foo\n" |
53 | testing "sed -n s//p" "sed -ne s/abc/def/p" "def\n" "" "abc\n" | 53 | testing "sed -n s//p" "sed -ne s/abc/def/p" "def\n" "" "abc\n" |
54 | test x"$SKIP_KNOWN_BUGS" = x"" && { | ||
54 | testing "sed s//g (exhaustive)" "sed -e 's/[[:space:]]*/,/g'" ",1,2,3,4,5,\n" \ | 55 | testing "sed s//g (exhaustive)" "sed -e 's/[[:space:]]*/,/g'" ",1,2,3,4,5,\n" \ |
55 | "" "12345\n" | 56 | "" "12345\n" |
57 | } | ||
56 | testing "sed s arbitrary delimiter" "sed -e 's woo boing '" "boing\n" "" "woo\n" | 58 | testing "sed s arbitrary delimiter" "sed -e 's woo boing '" "boing\n" "" "woo\n" |
57 | testing "sed s chains" "sed -e s/foo/bar/ -e s/bar/baz/" "baz\n" "" "foo\n" | 59 | testing "sed s chains" "sed -e s/foo/bar/ -e s/bar/baz/" "baz\n" "" "foo\n" |
58 | testing "sed s chains2" "sed -e s/foo/bar/ -e s/baz/nee/" "bar\n" "" "foo\n" | 60 | testing "sed s chains2" "sed -e s/foo/bar/ -e s/baz/nee/" "bar\n" "" "foo\n" |
@@ -72,6 +74,7 @@ testing "sed t (test/branch clears test bit)" "sed -e 's/a/b/;:loop;t loop'" \ | |||
72 | testing "sed T (!test/branch)" "sed -e 's/a/1/;T notone;p;: notone;p'" \ | 74 | testing "sed T (!test/branch)" "sed -e 's/a/1/;T notone;p;: notone;p'" \ |
73 | "1\n1\n1\nb\nb\nc\nc\n" "" "a\nb\nc\n" | 75 | "1\n1\n1\nb\nb\nc\nc\n" "" "a\nb\nc\n" |
74 | 76 | ||
77 | test x"$SKIP_KNOWN_BUGS" = x"" && { | ||
75 | # Normal sed end-of-script doesn't print "c" because n flushed the pattern | 78 | # Normal sed end-of-script doesn't print "c" because n flushed the pattern |
76 | # space. If n hits EOF, pattern space is empty when script ends. | 79 | # space. If n hits EOF, pattern space is empty when script ends. |
77 | # Query: how does this interact with no newline at EOF? | 80 | # Query: how does this interact with no newline at EOF? |
@@ -80,6 +83,7 @@ testing "sed n (flushes pattern space, terminates early)" "sed -e 'n;p'" \ | |||
80 | # N does _not_ flush pattern space, therefore c is still in there @ script end. | 83 | # N does _not_ flush pattern space, therefore c is still in there @ script end. |
81 | testing "sed N (doesn't flush pattern space when terminating)" "sed -e 'N;p'" \ | 84 | testing "sed N (doesn't flush pattern space when terminating)" "sed -e 'N;p'" \ |
82 | "a\nb\na\nb\nc\n" "" "a\nb\nc\n" | 85 | "a\nb\na\nb\nc\n" "" "a\nb\nc\n" |
86 | } | ||
83 | testing "sed address match newline" 'sed "/b/N;/b\\nc/i woo"' \ | 87 | testing "sed address match newline" 'sed "/b/N;/b\\nc/i woo"' \ |
84 | "a\nwoo\nb\nc\nd\n" "" "a\nb\nc\nd\n" | 88 | "a\nwoo\nb\nc\nd\n" "" "a\nb\nc\nd\n" |
85 | 89 | ||
@@ -99,13 +103,17 @@ testing "sed d ends script iteration (2)" \ | |||
99 | "sed -e '/ook/d;a\' -e 'bang'" "woot\nbang\n" "" "ook\nwoot\n" | 103 | "sed -e '/ook/d;a\' -e 'bang'" "woot\nbang\n" "" "ook\nwoot\n" |
100 | 104 | ||
101 | # Multiple files, with varying newlines and NUL bytes | 105 | # Multiple files, with varying newlines and NUL bytes |
106 | test x"$SKIP_KNOWN_BUGS" = x"" && { | ||
102 | testing "sed embedded NUL" "sed -e 's/woo/bang/'" "\0bang\0woo\0" "" \ | 107 | testing "sed embedded NUL" "sed -e 's/woo/bang/'" "\0bang\0woo\0" "" \ |
103 | "\0woo\0woo\0" | 108 | "\0woo\0woo\0" |
109 | } | ||
104 | testing "sed embedded NUL g" "sed -e 's/woo/bang/g'" "bang\0bang\0" "" \ | 110 | testing "sed embedded NUL g" "sed -e 's/woo/bang/g'" "bang\0bang\0" "" \ |
105 | "woo\0woo\0" | 111 | "woo\0woo\0" |
112 | test x"$SKIP_KNOWN_BUGS" = x"" && { | ||
106 | echo -e "/woo/a he\0llo" > sed.commands | 113 | echo -e "/woo/a he\0llo" > sed.commands |
107 | testing "sed NUL in command" "sed -f sed.commands" "woo\nhe\0llo\n" "" "woo" | 114 | testing "sed NUL in command" "sed -f sed.commands" "woo\nhe\0llo\n" "" "woo" |
108 | rm sed.commands | 115 | rm sed.commands |
116 | } | ||
109 | 117 | ||
110 | # sed has funky behavior with newlines at the end of file. Test lots of | 118 | # sed has funky behavior with newlines at the end of file. Test lots of |
111 | # corner cases with the optional newline appending behavior. | 119 | # corner cases with the optional newline appending behavior. |
@@ -120,8 +128,10 @@ testing "sed empty file plus cat" "sed -e 's/nohit//' input -" "one\ntwo" \ | |||
120 | "" "one\ntwo" | 128 | "" "one\ntwo" |
121 | testing "sed cat plus empty file" "sed -e 's/nohit//' input -" "one\ntwo" \ | 129 | testing "sed cat plus empty file" "sed -e 's/nohit//' input -" "one\ntwo" \ |
122 | "one\ntwo" "" | 130 | "one\ntwo" "" |
131 | test x"$SKIP_KNOWN_BUGS" = x"" && { | ||
123 | testing "sed append autoinserts newline" "sed -e '/woot/a woo' -" \ | 132 | testing "sed append autoinserts newline" "sed -e '/woot/a woo' -" \ |
124 | "woot\nwoo\n" "" "woot" | 133 | "woot\nwoo\n" "" "woot" |
134 | } | ||
125 | testing "sed insert doesn't autoinsert newline" "sed -e '/woot/i woo' -" \ | 135 | testing "sed insert doesn't autoinsert newline" "sed -e '/woot/i woo' -" \ |
126 | "woo\nwoot" "" "woot" | 136 | "woo\nwoot" "" "woot" |
127 | testing "sed print autoinsert newlines" "sed -e 'p' -" "one\none" "" "one" | 137 | testing "sed print autoinsert newlines" "sed -e 'p' -" "one\none" "" "one" |
@@ -137,9 +147,11 @@ testing "sed selective matches insert newline" \ | |||
137 | testing "sed selective matches noinsert newline" \ | 147 | testing "sed selective matches noinsert newline" \ |
138 | "sed -ne 's/woo/bang/p' input -" "a bang\nb bang" "a woo\nb woo" \ | 148 | "sed -ne 's/woo/bang/p' input -" "a bang\nb bang" "a woo\nb woo" \ |
139 | "c no\nd no" | 149 | "c no\nd no" |
150 | test x"$SKIP_KNOWN_BUGS" = x"" && { | ||
140 | testing "sed clusternewline" \ | 151 | testing "sed clusternewline" \ |
141 | "sed -e '/one/a 111' -e '/two/i 222' -e p input -" \ | 152 | "sed -e '/one/a 111' -e '/two/i 222' -e p input -" \ |
142 | "one\none\n111\n222\ntwo\ntwo" "one" "two" | 153 | "one\none\n111\n222\ntwo\ntwo" "one" "two" |
154 | } | ||
143 | testing "sed subst+write" \ | 155 | testing "sed subst+write" \ |
144 | "sed -e 's/i/z/' -e 'woutputw' input -; echo -n X; cat outputw" \ | 156 | "sed -e 's/i/z/' -e 'woutputw' input -; echo -n X; cat outputw" \ |
145 | "thzngy\nagaznXthzngy\nagazn" "thingy" "again" | 157 | "thzngy\nagaznXthzngy\nagazn" "thingy" "again" |
@@ -175,8 +187,12 @@ testing "sed lie-to-autoconf" "sed --version | grep -o 'GNU sed version '" \ | |||
175 | "GNU sed version \n" "" "" | 187 | "GNU sed version \n" "" "" |
176 | 188 | ||
177 | # Jump to nonexistent label | 189 | # Jump to nonexistent label |
178 | testing "sed nonexistent label" "sed -e 'b walrus' 2> /dev/null || echo yes" \ | 190 | test x"$SKIP_KNOWN_BUGS" = x"" && { |
191 | # Incompatibility: illegal jump is not detected if input is "" | ||
192 | # (that is, no lines at all). GNU sed 4.1.5 complains even in this case | ||
193 | testing "sed nonexistent label" "sed -e 'b walrus' 2>/dev/null || echo yes" \ | ||
179 | "yes\n" "" "" | 194 | "yes\n" "" "" |
195 | } | ||
180 | 196 | ||
181 | testing "sed backref from empty s uses range regex" \ | 197 | testing "sed backref from empty s uses range regex" \ |
182 | "sed -e '/woot/s//eep \0 eep/'" "eep woot eep" "" "woot" | 198 | "sed -e '/woot/s//eep \0 eep/'" "eep woot eep" "" "woot" |
diff --git a/testsuite/sort.tests b/testsuite/sort.tests index f700dc0c1..627ca51f8 100755 --- a/testsuite/sort.tests +++ b/testsuite/sort.tests | |||
@@ -45,8 +45,8 @@ egg 1 2 papyrus | |||
45 | 999 3 0 algebra | 45 | 999 3 0 algebra |
46 | " "$data" "" | 46 | " "$data" "" |
47 | 47 | ||
48 | # Busybox is definitely doing this one wrong just now. FIXME | 48 | test x"$SKIP_KNOWN_BUGS" = x"" && { |
49 | 49 | # Busybox is definitely doing these wrong. FIXME | |
50 | testing "sort key range with numeric option and global reverse" \ | 50 | testing "sort key range with numeric option and global reverse" \ |
51 | "sort -k2,3n -r input" \ | 51 | "sort -k2,3n -r input" \ |
52 | "egg 1 2 papyrus | 52 | "egg 1 2 papyrus |
@@ -56,8 +56,6 @@ testing "sort key range with numeric option and global reverse" \ | |||
56 | 7 3 42 soup | 56 | 7 3 42 soup |
57 | " "$data" "" | 57 | " "$data" "" |
58 | 58 | ||
59 | # | ||
60 | |||
61 | testing "sort key range with multiple options" "sort -k2,3rn input" \ | 59 | testing "sort key range with multiple options" "sort -k2,3rn input" \ |
62 | "7 3 42 soup | 60 | "7 3 42 soup |
63 | 999 3 0 algebra | 61 | 999 3 0 algebra |
@@ -65,6 +63,7 @@ testing "sort key range with multiple options" "sort -k2,3rn input" \ | |||
65 | 42 1 3 woot | 63 | 42 1 3 woot |
66 | egg 1 2 papyrus | 64 | egg 1 2 papyrus |
67 | " "$data" "" | 65 | " "$data" "" |
66 | } | ||
68 | 67 | ||
69 | testing "sort key range with two -k options" "sort -k 2,2n -k 1,1r input" "\ | 68 | testing "sort key range with two -k options" "sort -k 2,2n -k 1,1r input" "\ |
70 | d 2 | 69 | d 2 |
diff --git a/testsuite/testing.sh b/testsuite/testing.sh index a57c4d68d..22c640faf 100755 --- a/testsuite/testing.sh +++ b/testsuite/testing.sh | |||
@@ -36,6 +36,20 @@ | |||
36 | export FAILCOUNT=0 | 36 | export FAILCOUNT=0 |
37 | export SKIP= | 37 | export SKIP= |
38 | 38 | ||
39 | # Helper for helpers. Oh my... | ||
40 | |||
41 | test x"$ECHO" != x"" || { | ||
42 | ECHO="echo" | ||
43 | test x"`echo -ne`" = x"" || { | ||
44 | # Compile and use a replacement 'echo' which understands -e -n | ||
45 | ECHO="$PWD/echo-ne" | ||
46 | test -x "$ECHO" || { | ||
47 | gcc -Os -o "$ECHO" ../scripts/echo.c || exit 1 | ||
48 | } | ||
49 | } | ||
50 | export ECHO | ||
51 | } | ||
52 | |||
39 | # Helper functions | 53 | # Helper functions |
40 | 54 | ||
41 | optional() | 55 | optional() |
@@ -73,7 +87,7 @@ testing() | |||
73 | 87 | ||
74 | $ECHO -ne "$3" > expected | 88 | $ECHO -ne "$3" > expected |
75 | $ECHO -ne "$4" > input | 89 | $ECHO -ne "$4" > input |
76 | [ -z "$VERBOSE" ] || echo "echo '$5' | $2" | 90 | [ -z "$VERBOSE" ] || echo "echo -ne '$5' | $2" |
77 | $ECHO -ne "$5" | eval "$2" > actual | 91 | $ECHO -ne "$5" | eval "$2" > actual |
78 | RETVAL=$? | 92 | RETVAL=$? |
79 | 93 | ||
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index ca0b17efe..5d1d2af31 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c | |||
@@ -374,7 +374,7 @@ static int ask(const char *string, int def) | |||
374 | */ | 374 | */ |
375 | static void check_mount(void) | 375 | static void check_mount(void) |
376 | { | 376 | { |
377 | if (find_mount_point(device_name)) { | 377 | if (find_mount_point(device_name, 0)) { |
378 | int cont; | 378 | int cont; |
379 | #if ENABLE_FEATURE_MTAB_SUPPORT | 379 | #if ENABLE_FEATURE_MTAB_SUPPORT |
380 | /* | 380 | /* |
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index 18512a395..cf757610b 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c | |||
@@ -682,7 +682,7 @@ int mkfs_minix_main(int argc UNUSED_PARAM, char **argv) | |||
682 | G.total_blocks = 65535; | 682 | G.total_blocks = 65535; |
683 | 683 | ||
684 | /* Check if it is mounted */ | 684 | /* Check if it is mounted */ |
685 | if (find_mount_point(G.device_name)) | 685 | if (find_mount_point(G.device_name, 0)) |
686 | bb_error_msg_and_die("can't format mounted filesystem"); | 686 | bb_error_msg_and_die("can't format mounted filesystem"); |
687 | 687 | ||
688 | xmove_fd(xopen(G.device_name, O_RDWR), dev_fd); | 688 | xmove_fd(xopen(G.device_name, O_RDWR), dev_fd); |
diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c index dff10f9e1..bdd4dd803 100644 --- a/util-linux/mkfs_vfat.c +++ b/util-linux/mkfs_vfat.c | |||
@@ -279,7 +279,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv) | |||
279 | ) | 279 | ) |
280 | bb_error_msg_and_die("will not try to make filesystem on full-disk device (use -I if wanted)"); | 280 | bb_error_msg_and_die("will not try to make filesystem on full-disk device (use -I if wanted)"); |
281 | // can't work on mounted filesystems | 281 | // can't work on mounted filesystems |
282 | if (find_mount_point(device_name)) | 282 | if (find_mount_point(device_name, 0)) |
283 | bb_error_msg_and_die("can't format mounted filesystem"); | 283 | bb_error_msg_and_die("can't format mounted filesystem"); |
284 | #endif | 284 | #endif |
285 | // get true sector size | 285 | // get true sector size |