From 1747b20cf009b76f817c5fe6ad94b1e5cbe85c32 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 13 Jun 2022 22:44:49 +0200 Subject: [PATCH] sleep: return 1 is no arg + customize one of the tests (tests/misc/sleep.sh) --- src/uu/sleep/src/sleep.rs | 2 +- util/build-gnu.sh | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/uu/sleep/src/sleep.rs b/src/uu/sleep/src/sleep.rs index 4d5095c31..17c393982 100644 --- a/src/uu/sleep/src/sleep.rs +++ b/src/uu/sleep/src/sleep.rs @@ -31,7 +31,7 @@ mod options { #[uucore::main] pub fn uumain(args: impl uucore::Args) -> UResult<()> { - let matches = uu_app().get_matches_from(args); + let matches = uu_app().try_get_matches_from(args)?; if let Some(values) = matches.values_of(options::NUMBER) { let numbers = values.collect::>(); diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 04f9526bd..e6879d589 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -198,4 +198,8 @@ sed -i -e "s/provoked error./provoked error\ncat pat |sort -u > pat/" tests/misc # Update the GNU error message to match ours sed -i -e "s/ln: 'f' and 'f' are the same file/ln: failed to link 'f' to 'f': Same file/g" tests/ln/hard-backup.sh -sed -i -e "s/failed to access 'no-such-dir'\":/failed to link 'no-such-dir'\"/" -e "s/link-to-dir: hard link not allowed for directory/failed to link 'link-to-dir' to/" -e "s|link-to-dir/: hard link not allowed for directory|failed to link 'link-to-dir/' to|" tests/ln/hard-to-sym.sh \ No newline at end of file +sed -i -e "s/failed to access 'no-such-dir'\":/failed to link 'no-such-dir'\"/" -e "s/link-to-dir: hard link not allowed for directory/failed to link 'link-to-dir' to/" -e "s|link-to-dir/: hard link not allowed for directory|failed to link 'link-to-dir/' to|" tests/ln/hard-to-sym.sh + +# sleep without arg returns 2 on our side, 1 on GNU's +# GNU sleep accepts some crazy string, not sure we should match this behavoir +sed -i -e "s/timeout 10 sleep 0x.002p1/#timeout 10 sleep 0x.002p1/" tests/misc/sleep.sh