Commit graph

141 commits

Author SHA1 Message Date
Niyaz Nigmatullin
306272bf60 unix_sockets is deprecated, use std::os::unix::net instead 2022-08-20 17:02:29 +03:00
Jan Scheer
391709c911
tests: ignore failing tests for FreeBSD (#3778) 2022-08-13 10:09:05 +02:00
Pierre Marsais
4ad0d5c5a3
ls: Implement --zero flag. (#2929) (#3746)
* ls: Implement --zero flag. (#2929)

This flag can be used to provide a easy machine parseable output from
ls, as discussed in the GNU bug report
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49716.

There are some peculiarities with this flag:

 - Current implementation of GNU ls of the `--zero` flag implies some
   other flags. Those can be overridden by setting those flags after
   `--zero` in the command line.
 - This flag is not compatible with `--dired`. This patch is not 100%
   compliant with GNU ls: GNU ls `--zero` will fail if `--dired` and
   `-l` are set, while with this patch only `--dired` is needed for the
   command to fail.

We also add `--dired` flag to the parser, with no additional behaviour
change.

Testing done:
```
$ bash util/build-gnu.sh
 [...]
$ bash util/run-gnu-test.sh tests/ls/zero-option.sh
 [...]
 PASS: tests/ls/zero-option.sh
 ============================================================================
 Testsuite summary for GNU coreutils 9.1.36-8ec11
 ============================================================================
 # TOTAL: 1
 # PASS:  1
 # SKIP:  0
 # XFAIL: 0
 # FAIL:  0
 # XPASS: 0
 # ERROR: 0
 ============================================================================
```

* Use the US way to spell Behavior

* Fix formatting with cargo fmt -- tests/by-util/test_ls.rs

* Simplify --zero flag overriding logic by using index_of

Also, allow multiple --zero flags, as this is possible with GNU ls
command. Only the last one is taken into account.

Co-authored-by: Sylvestre Ledru <sledru@mozilla.com>
2022-07-31 19:02:50 +02:00
Sam Nystrom
4e72e284b5
ls: silently ignore -T option (#3718)
* ls: silently ignore `-T` option
2022-07-26 10:35:43 +02:00
Sylvestre Ledru
882cd527ff
Merge pull request #3704 from Sciencentistguy/once_cell
Replace lazy_static with once_cell
2022-07-13 16:15:47 +02:00
Jamie Quigley
1a270361c0
Replace lazy_static with once_cell 2022-07-12 14:08:30 +01:00
Niyaz Nigmatullin
da5808d4ac
ls: add already listed message (#3707)
* ls: handle looping symlinks infinite printing

* ls: better coloring and printing symlinks when dereferenced

* tests/ls: add dereferencing and symlink loop tests

* ls: reformat changed using rustfmt

* ls: follow clippy advice for cleaner code

* uucore/fs: fix FileInformation to open directory handles in Windows as
well
2022-07-11 17:18:58 +02:00
anastygnome
0ef6732632
Add a test like the one in the issue.
Signed-off-by: anastygnome <noreplygitemail@protonmail.com>
2022-06-13 11:29:13 +02:00
Joerg Jaspert
fd1e0e6dd7 Correctly parse numbers starting with 0 as octal 2022-06-12 12:55:33 +02:00
Joerg Jaspert
c513692bae Test for (against) octal-looking width 2022-06-11 22:43:46 +02:00
Terts Diepraam
626ed43e05 ls: fix double quoting when color is enabled
When color was enabled the escape_name function was called twice which led to names like `hello world` being displayed as `"'hello world'".
2022-06-03 00:29:56 +02:00
Thomas Queiroz
0b24839a1e
tests/ls: add --group-directories-first test 2022-05-21 18:57:53 -03:00
Thomas Queiroz
c4606266e4
tests/ls: update version sort test 2022-05-21 18:50:26 -03:00
Jeffrey Finkelstein
896bbec760 all: clippy fixes 2022-05-13 22:47:56 -04:00
Justin Tracey
2a0d58d060 get android builds to compile and pass tests 2022-04-20 08:44:49 +02:00
Sylvestre Ledru
d0aa9a9927
Merge pull request #3343 from uutils/dependabot/cargo/lscolors-0.9.0
build(deps): bump lscolors from 0.7.1 to 0.9.0
2022-04-09 09:29:25 +02:00
Terts Diepraam
54b2fe700b fix regressed test due to lscolors update 2022-04-07 11:05:20 +02:00
Terts Diepraam
18369dc0be all: use array intoiterator 2022-04-05 10:39:31 +02:00
Sylvestre Ledru
c79d146dde ls: add support for --quoting-style=shell-escape b --color=auto 2022-03-27 10:50:00 +02:00
Sylvestre Ledru
bbee22bb1c ls: Add missing quote with --quoting-style=shell-escape
Should fix GNU: tests/ls/symlink-quote.sh
2022-03-27 10:50:00 +02:00
Sylvestre Ledru
187bddb6af ls: support multiple -a or -A 2022-03-21 13:32:23 +01:00
Sylvestre Ledru
af8726af43 ls: when -aA are provided, the order matters 2022-03-20 23:23:17 +01:00
kimono-koans
fa6af85b8e
ls: Fix display of inodes and add allocation size feature (#3052) 2022-03-15 16:27:43 +01:00
Terts Diepraam
722c5d268f fix Rust 1.59 clippy lints 2022-02-25 09:39:48 +01:00
Sylvestre Ledru
67cee26abe
Merge pull request #3003 from tertsdiepraam/ls-fix-another-flaky-test
`ls`: fix flaky test `test_ls_io_errors`
2022-02-15 20:11:48 +01:00
Abhishek C Sharma
3f6fe7f388
ls: add new optional arguments to --classify flag (#3041)
* ls: add new optional arguments to --classify flag

The --classify flag in ls now takes an option when argument
that may have the values always, auto and none.

Modified clap argument to allow an optional parameter and
changed the classify flag value parsing logic to account for
this change.

* ls: add test for indicator-style, ind and classify with value none

* ls: require option paramter to --classify to use a = to specify flag value

* ls: account for all the undocumented possible values for the --classify flag

Added the other values for the --classify flag along with modifications to tests.
Also documented the inconsistency between GNU coreutils because we accept the
flag value even for the short version of the flag.
2022-02-10 21:35:20 +01:00
Hanif Bin Ariffin
560cd74a63 test_ls: Do not rely on the system time of metadata'access time
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.43262@gmail.com>
2022-02-02 12:49:40 +08:00
Terts Diepraam
08f1199b08 ls: fix flaky test test_ls_io_errors 2022-02-01 10:55:15 +01:00
Sylvestre Ledru
829e4fcb2c
Merge pull request #2970 from tertsdiepraam/ls-fix-flaky-test
`ls`: fix flaky test
2022-01-31 14:26:40 +01:00
Terts Diepraam
e01e2141f5 ls: fix flaky test (#2969) 2022-01-30 20:09:20 +01:00
Daniel Eades
784f2e2ea1 use semicolons if nothing returned 2022-01-30 15:08:26 +01:00
Sylvestre Ledru
bfa2d8b7da
Merge pull request #2875 from kimono-koans/ls_bad_fd_2
ls: Fix display of bad file descriptor errors
2022-01-30 09:59:58 +01:00
Terts Diepraam
2412e4cbf7 add some tests for Clap's InferLongArgs setting 2022-01-29 02:06:32 +01:00
electricboogie
8b6c1337aa Fix broken test in certain Linux containers 2022-01-27 15:36:55 -06:00
Justin Tracey
b65815cd06 ls: fix clippy lints in tests 2022-01-21 15:56:42 -05:00
Terts Diepraam
77229aea86 ls: fix tests for windows 2022-01-18 13:47:50 +01:00
electricboogie
4bee6526bf Add new test, never print error on deref-ed bad fd 2022-01-17 13:14:43 -06:00
electricboogie
15efba54c5 Use dir_entry metadata for dereferenced bad fds to match GNU, add comments, clippy lints 2022-01-16 10:20:50 -06:00
electricboogie
37ca6edfdc Fix display of bad fd errors 2022-01-15 22:39:07 -06:00
kimono-koans
fd5310411e
ls: Fix device display (#2855) 2022-01-15 00:39:56 +01:00
kimono-koans
016d5e72ad
ls: Fix padding for dangling links in non-Long formats (#2856)
* Fix padding for dangling links in non-long formats

Co-authored-by: electricboogie <32370782+electricboogie@users.noreply.github.com>
2022-01-11 12:01:54 +01:00
Sylvestre Ledru
dcfdeb334d
Merge pull request #2854 from kimono-koans/ls_fix_errno_1
ls: Fix Errno 1, print errors at the md call point
2022-01-09 20:56:06 +01:00
moko256
5659bf8fae
ls: On Windows use DirEntry#metadata() instead of fs::metadata 2022-01-10 02:56:22 +09:00
electricboogie
4052d4ec6a Add test for double printing dangling link errors 2022-01-08 12:10:52 -06:00
kimono-koans
4ea61545c6
Merge branch 'uutils:master' into ls_fix_errno_1 2022-01-07 21:48:53 -06:00
electricboogie
13d6d74fa3 Fix Windows test(?): inode request shouldn't error on Windows, b/c there are no inodes 2022-01-07 09:24:32 -06:00
electricboogie
882b8ddd7b Fix test dir names for Windows 2022-01-06 15:41:53 -06:00
electricboogie
30b2425541 Fix newline when only dirs in base directory, and test 2022-01-06 14:58:56 -06:00
kimono-koans
421330d07a
ls: Improve error handling and other improvements (#2809)
*  print error in the correct order by flushing the stdout buffer before printing an error
*  print correct GNU error codes
*  correct formatting for config.inode, and for dangling links
*  correct padding for Format::Long
*  remove colors after the -> link symbol as this doesn't match GNU
*  correct the major, minor #s for char devices, and correct padding
*  improve speed for all metadata intensive ops by not allocating metadata unless in a Sort mode
*  new tests, have struggled with how to deal with stderr, stdout ordering in a test though
*  tried to implement UIoError, but am still having issues matching the formatting of GNU


Co-authored-by: electricboogie <32370782+electricboogie@users.noreply.github.com>
2022-01-05 14:50:37 +01:00
kimono-koans
fd64e01d92
ls: Reduce binary size of ls by removing regex crate (#2781) 2021-12-22 18:31:45 +01:00