ln had a bunch of problems:
1. `ln -s target` didn't work (2nd form in help).
2. `ln -t tmp` wasn't an error. We should check if files are
empty first.
3. `ln -s file dir` didn't create dir/file.
4. `ln -s -T file dir` was removing `dir`.
5. Test cases for 4 say this is for compatibility with GNU
coreutils but I couldn't find this feature.
Path::is_dir follows symlinks so it returns true for symlinks
to directories. Use symlink_metadata instead so you can remove
symlinks to directories without -r flag.
Currently, mkdir always succeeds for existing files and it
even modifies their mode. With this change, only mkdir -p for
existing directories will be allowed.
Make at_line_start persist between printing each file. This fixes an
issue when numbering lines in the output and one of the input files
does not have a trailing newline.
- adds conditional supports for unix domain sockets
- adds unix domain socket test
- adds Results to functions, removing unwraps
- uutils `cat` used to panic on broken stdout pipes (e.g. `cat
/dev/zero | head -c1`). this is fixed in this PR
- updated to exit 0 on success, and 1 if an error occurs.
- adds docstrings
- adds an error log on printing a directory
- adds categorization of other filetypes for extensible
differentiation of behaviors
- adds OutputOptions struct to replace params for extensibility
- adds correct status code on exit
Fixes#1017.
test_mkdir_dup_dir asserted that creating an existing directory is an
error, but that's not how GNU coreutils behaves. This has been reported
in #121, but wasn't fixed (only the `-p` case was).
`test_chmod_ugoa` and `test_chmod_many_options` both change umask, which
is global state. Since tests run concurrently, this might lead to
a situation where one of the tests changes umask to a value that screws
another test's checks. To prevent this, we introduce a mutex that should
be held by any test that changes umask.
Unfortunately, there's no way to hide umask behind this mutex and
enforce its usage: programmers will have to maintain the discipline
themselves.
`test_chmod_many_options` relied on user's umask not denying read access
for anyone. 022, which is the default umask for many, indeed allows read
access for everyone. I'm using 027, which disallows read for everyone
but owner and group. This made tests fail.
Now tests set and reset umask, ensuring checks are run in a reliable,
predictable environment.
/dev/pts/ptmx seems to be the only character special file in /dev
which is not a bind-mount in the docker container run by travis.
gnu stat does not detect these mounts, so produces a different
output for /dev/zero.
* update status in README.md
* enable busybox tests
Adding `CONFIG_DESKTOP` and `CONFIG_LONG_OPTS` to busybox config.
These flags also enable other tests, but those utilities are not
included in `TEST_PROGS`. (eg. awk)
* fix whitespace and small issues
* fix Eq imp for FormatWriter on nightly + beta
* fix indention in multifilereader.rs
* fix intermittent errors in tests
main panics when following /dev/stdin since /dev/stdin is not seekable.
Check to see if file is seekable and use unbounded_seek if so.
Also `tail -f` with no files should not follow stdin.
Although for some tests this adds characters
we still use them there because the
brevity cost is now worth the benefit in
terms of instant, natural-language readability
and recognizability for people not familiar
with this tests of this module or even the project
FileMerger receives Lines Iterables of the pre-sorted input files
via push_file() It implements Iterator, which yields lines from the
input files in (merged) sorted order. If the input files are not sorted,
then the behavior is undefined.
Internally, FileMerger uses a
std::collections::BinaryHeap<MergeableFile>.
MergeableFile is an internal helper that implements Ord in a way that
BinaryHeap can use (note that we want smallest-first, but BinaryHeap
returns largest first, so MergeableFile::cmp() calls reverse() on
whatever compare_by() returns.
Made a new function sort_by(lines, compare_fns), which accepts a
list of compare_fns and calls lines.sort_by() with a closure that
calls each compare_fn in turn until one returns something other
than equal.
Default behavior ensures that String::cmp is the last element in the
compare_fns list (referred to as 'last resort' sorting by man sort).
Passing --stable (-s) turns this behaviour off.
Test cases provided for `sort --month` and `sort --month --stable`.
Updates to individual integration tests
- use proposed conventional approach to beginning tests
- use new convenience functions for using fixtures
- use new names for TestScenario
Updates to integration test modules
- add proposed conventional module-level functions
Updates to test/common/util.rs
- rename TestSet, and its methods, for semantic clarity
- create convenience functions for use of fixtures
- delete convenience functions obsoleted by new conventions
We now accept symbolic and numeric mode strings using the
--mode or -m option for install. This is used either when
moving files into a directory, or when creating component
directories with the -d option. This feature was designed
to mirror the GNU implementation, including the possibly
quirky behaviour of `install --mode=u+wx file dir`
resulting in dir/file having exactly permissions 0300.
Extensive integration tests are included.
This chnage required a higher libc dependency.
We check if the user has given one of the (many)
not yet implemented command line arguments. Upon
catching this, we display the specific transgressor
to stderr and exit with return code 2.
This behaviour is tested in one new integration test.
Bare minimum functionality of `install file dir` implemented.
Also added TODO markers in code for outstanding parameters
and split main function into smaller logical chunks.
Add install utility skeleton source, based on
mv, including the getopts setup mirroring
GNU's `man install` documentation. Also
add a single test and build system code.