Commit Graph
59 Commits
Author SHA1 Message Date
Guillem L. Jara 613e9be6bb chore(stat): add test case for file metadata 2026-01-01 19:49:10 +01:00
Guillem L. Jara 7c489120dc chore(stat): Add test case for percent escaping 2026-01-01 19:49:10 +01:00
Andrew Gaul 5274576311 Include subsecond precision in stat atime/ctime
Previously only mtime supported this.  Follows on to
1d0dcb5962.  References #3233.
References s3fs-fuse/s3fs-fuse#2740.
2025-10-13 10:54:42 -07:00
Ahmed hossamandGitHub d79c18a693 Merge pull request #8791 from dekuu5/stat/fix-symlink-behavior
stat: fix %N symlink to be single quote instead of double quote
2025-10-12 18:40:54 +02:00
Ahmed hossamandGitHub 12e875c0a2 Merge pull request #8538 from dekuu5/fix/stat-string-to-osstr
stat: fix mount point handling for non-UTF8 paths
2025-09-24 16:34:36 +02:00
Daniel Hofstetter 3210638168 ls,stat: fix single_char_pattern in tests 2025-04-18 13:52:47 +02:00
Sylvestre Ledru c7d39dded6 stat: add support for selinux 2025-04-16 10:21:37 +02:00
Yuri Astrakhan 982805d3cd chore: manual inline formatting
Minor manual cleanup - inlined many format args.  This makes the code a bit more readable, and helps spot a few inefficiencies and possible bugs.  Note that `&foo` in a `format!` parameter results in a 6% extra performance cost, and does not get inlined by the compiler (yet).
2025-04-08 00:23:21 -04:00
Nicolas Boichat ae743a976d test_stat: Disable test_stdin_pipe_fifo1/2 on Mac OS X
It's not totally clear why they sometimes work, sometimes fail,
but it does appear that running `stat` on `/dev/stdin` is perhaps
not the most reliable approach.

A likely more solid approach is described in #7583.
2025-03-29 17:11:41 +01:00
Sylvestre Ledru a0179ea239 uutests: adjust the tests to use them 2025-03-28 21:40:31 +01:00
Sylvestre Ledru a85539f530 Run cargo fmt on the tree 2025-03-24 21:33:12 +01:00
Daniel Hofstetter df4dfea852 tests: replace run() with succeeds() or fails() 2025-03-09 16:53:56 +01:00
Sylvestre Ledru 18cb7dcf9e Use the new function fails_with_code
Done with
```
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.no_stdout\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2)\n\1.no_stdout();/gs' *rs
$ sed -i -e "s|.fails()(.*).code_is(|.fails_with_code(|g" *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2);/gs' *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)(.*?)[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\3)\2;/gs' *rs
...
```
2025-03-01 17:26:20 +01:00
Jeffrey Finkelstein f59c7899c3 Add more test cases and improve precision 2025-01-11 11:27:18 -05:00
Jeffrey Finkelstein 1d0dcb5962 stat: fix precision when rendering mtime (%Y)
Support precision when rendering the time of last data modification
with `stat`. For example, after this commit

    $ stat --printf='%.1Y\n' f
    1668645806.7

Previously, the precision in the format specification was
ignored. This is implemented with a custom renderer because GNU `stat`
seems to truncate the number as opposed to rounding the number as
would happen when using `format!` with a specified number of digits of
precision.

Fixes #3233
2025-01-10 21:31:01 -05:00
Sylvestre LedruandGitHub c60203ddd3 stat: improve GNU compatibility (#6933)
* stat: fix the quotes when dealing with %N

and other formats
should fix
tests/stat/stat-fmt.sh

* stats: use an enum instead of a string

* stats: split the functions into smaller functions

* stat: handle byte as a format for better display

* stat: handle error better. should make tests/stat/stat-printf.pl pass

* stat: Some escape sequences are non-standard

* Fix tests

* Take comments into account
2024-12-10 08:48:52 +01:00
Laurent Cheylus 6bce1626b3 tests: disable failed tests for stat on OpenBSD
Signed-off-by: Laurent Cheylus <foxy@free.fr>
2024-07-06 22:29:18 +02:00
n4n5 ab67947321 fix clippy tests 2024-06-30 16:27:08 +02:00
fd4e1cfb28 stat: should fail without arguments #5928 (#5935)
* stat: should fail without arguments #5928

* style and lint issue  stat: should fail without arguments #5928

* style and lint issue  stat: should fail without arguments #5928

* style and lint 2 issue  stat: should fail without arguments #5928

---------

Co-authored-by: biplab5464 <biplab5464@outlook.com>
2024-02-02 17:00:35 +01:00
Terts Diepraam c3f9e19a3b all: normalize license notice in all *.rs files 2023-08-24 12:21:09 +02:00
Rayhan Faizel 4143859266 tests/stat: Test case for using - and -f together 2023-08-10 08:41:19 +05:30
Daniel Hofstetter 5d03d2d9d4 clippy: fix warnings introduced by Rust 1.71.0 2023-07-13 17:35:33 +02:00
Daniel Hofstetter 7a888da409 tests: remove all "extern crate" statements 2023-04-10 08:31:31 +02:00
Daniel Hofstetter 6988eb7ec6 tests: expand wildcard imports 2023-03-20 15:32:35 +01:00
Daniel Hofstetter f6b646e4e5 clippy: fix warnings introduced with Rust 1.67.0 2023-01-27 17:37:56 +01:00