Commit graph

373 commits

Author SHA1 Message Date
Joseph Crail
a94bd0bd35 Remove unstable regex macros.
This will allow coreutils to get further along when building against
Rust 1.0.
2015-05-19 21:40:03 -04:00
Heather
e7518b3eae Merge pull request #608 from jbcrail/rm-unstable-exit-status
Replace unstable set_exit_status() with exit().
2015-05-19 07:15:14 +03:00
Joseph Crail
7d1d307b92 Replace unstable set_exit_status() with exit().
With the 1.0 release, unstable features are causing build errors. I
replaced references to std::env::set_exit_status() with
std::process::exit().
2015-05-18 21:22:51 -04:00
Joseph Crail
430e9530d4 Fix nohup.
I upgraded to the nightly build.
2015-05-18 20:27:32 -04:00
Heather
37f35cd3f8 Merge pull request #605 from jbcrail/fix-stdbuf
Fix stdbuf.
2015-05-18 08:45:17 +03:00
Joseph Crail
c4d8312e6b Fix mkfifo on Linux.
The build failed because of type mismatch errors for the mode
permission.
2015-05-18 00:53:37 -04:00
Joseph Crail
a2400a272f Fix stdbuf.
The build only works on Linux at the moment.
2015-05-17 23:27:57 -04:00
Joseph Crail
7d71dfbbf4 Fix kill. 2015-05-17 15:26:52 -04:00
Joseph Crail
c93440170d Fix id. 2015-05-17 14:59:04 -04:00
Joseph Crail
1837146134 Update hashsum.
Most of the work centered around fixing lifetime issues.
2015-05-16 13:28:36 -04:00
kwantam
e1dac4695e improved Sieve implementation ; add cargo update
This commit adds `cargo update` to the distclean target in the
makefile. This updates the Cargo.lock file when clearing the
deps directory.

In addition, it adds a faster implementation of the Sieve of
Eratosthenes for use by `src/factor/gen_table.rs` and `test/factor.rs`.
2015-05-15 19:39:43 -04:00
Joseph Crail
349622a05b Fix du.
In addition to upgrading the nightly build, I flattened the Stat struct
to embed the metadata fields. This simplified access to the values, but
needed a constructor method for ergonomic reasons.
2015-05-14 18:35:55 -04:00
Heather
94cd6eb543 usernames can only be up to 104 characters in windows, fix #565 2015-05-14 08:27:47 +04:00
Heather
f0e5c19ed4 Merge pull request #597 from jbcrail/update-mkdir
Update mkdir.
2015-05-14 07:16:11 +03:00
Heather
aca7775926 Merge pull request #598 from jbcrail/fix-mv
Fix mv.
2015-05-14 07:14:54 +03:00
Joseph Crail
46bd77c3c2 Fix mkfifo. 2015-05-13 22:22:13 -04:00
Joseph Crail
18da32f394 Fix mv. 2015-05-13 21:05:36 -04:00
Joseph Crail
7f3d4ebf5b Update mkdir.
In addition to upgrading to the nightly build, I refactored the method
that creates the directories by switching from a recursive approach to
an iterative one. I also replaced the obsolete fs::mkdir() with a custom
method using fs::create_dir() and libc::chmod(). I added several
diagnostic messages that match the GNU implementation.
2015-05-13 16:38:11 -04:00
Heather
9b193d8d8a Merge pull request #594 from jbcrail/update-fold
Update fold to replace vector concatenation.
2015-05-13 07:22:47 +03:00
Heather
e078092c80 Merge pull request #595 from jbcrail/update-readlink
Update readlink.
2015-05-13 07:22:21 +03:00
Joseph Crail
f502b187a7 Remove tail return statements. 2015-05-12 19:54:12 -04:00
Joseph Crail
b2063d6d73 Update readlink.
I updated to the nightly build, completed support for the verbose flag,
and refactored the canonicalization method to simplify and add support
for Windows paths.
2015-05-12 17:07:31 -04:00
Joseph Crail
66a7dc8cb7 Update fold to replace vector concatenation.
The syntax for concatenating a vector and a slice use the '+' operator
was removed from Rust.
2015-05-12 16:52:15 -04:00
Heather
57050517f9 Merge pull request #593 from kwantam/master
fix `cut`
2015-05-12 07:10:02 +03:00
kwantam
aabbf83d88 fix cut
This commit updates `cut` to build on rust nightly.

In addition, it adds support for null input and output delimiters,
and fixes a bug in the `cut_characters()` function that would cause
incorrect output when two adjacent fields were specified in the range
list.
2015-05-11 21:15:39 -04:00
Joseph Crail
1ee57fa229 Fix nice. 2015-05-11 17:40:45 -04:00
Heather
c94a5ce808 Merge pull request #589 from jbcrail/fix-nl
Fix nl.
2015-05-11 08:08:50 +03:00
Heather
cf1723892d Merge pull request #590 from jbcrail/fix-nproc
Fix nproc.
2015-05-11 08:08:21 +03:00
Joseph Crail
b20bde94cb Fix od.
I upgraded to the nightly build and replaced the unstable BYTES constant
with mem::size_of().
2015-05-11 00:48:36 -04:00
Joseph Crail
58de022ed4 Fix nproc.
Since std::os::num_cpus() was removed from the library, I added the
num_cpus crate to the dependencies.
2015-05-10 22:20:20 -04:00
Joseph Crail
28c21902c5 Fix nl.
Aside from the usual upgrades to sync with the nightly build, I fixed an
unwrap() panic when reading lines with only a newline. I also refactored
the repeated command calls to use helper functions.
2015-05-10 18:59:37 -04:00
Joseph Crail
aa6a9c6fd7 Cleanup pwd.
I removed an unused argument from the usage documentation. I also
removed the redundant return calls.
2015-05-09 23:45:43 -04:00
Heather
1f67aaaf8c Merge pull request #585 from jbcrail/add-basename-split-tests
Add initial tests for basename/split.
2015-05-09 22:20:23 +03:00
Joseph Crail
234c81311f Add initial tests for split.
I created random data to test several cases. I verified that the data is
split into the correct number of files and can also be reassembled into
the original file.
2015-05-09 13:32:30 -04:00
Joseph Crail
3abf19a595 Fix basename when trailing slashes are present.
The GNU implementation first strips all trailing slashes before deleting
the directory portion. This case wasn't handled.

I also rewrote the method that strips the directory to use the PathBuf
methods for improved platform-indepedence.
2015-05-09 13:23:48 -04:00
Heather
39de3f7b71 Merge pull request #581 from kwantam/master
fix `rm` and `rmdir`
2015-05-09 08:11:28 +03:00
Joseph Crail
10339e6c32 Fix split.
I upgraded to the nightly build.
2015-05-08 23:11:15 -04:00
kwantam
a3acb00394 fix rmdir 2015-05-08 20:24:03 -04:00
kwantam
4854eb238d fix rm
In addition, this commit brings the behavior of `rm` better in line
with the behavior of GNU Coreutils rm, especially as regarding recursive
interactive deletion of directories. This version asks to delete files
in a different order from GNU rm, but it now gives the option of stopping
the recursion at each new directory that is reached.
2015-05-08 19:42:19 -04:00
Joseph Crail
dd19bc27c1 Update fold to nightly build. 2015-05-08 00:57:41 -04:00
Heather
4e2cd4dd24 Merge pull request #580 from jbcrail/remove-unused-feature
Remove unused feature from cat.
2015-05-08 07:46:21 +03:00
kwantam
ff24d48e73 modify factor impl to eliminate overflow issue
This change does the following:

1. Updates the arithmetic functions in `src/factor/numeric.rs` to
   correctly handle all cases up to 2^64. When numbers are larger
   than 2^63, we fall back to slightly slower routines that check
   for and handle overflow.

2. Since the arithmetic functions will now not overflow, we no longer
   need the safety net trial division implementation. We now always
   use Pollard's rho after eliminating small (<=13 bit) primes.

3. Slight tweak in `src/factor/gen_table.rs` to generate the first
   1027 primes, which means we test every prime of 13 or fewer bits
   before going into Pollard's rho. Includes corresponding update in
   `src/factor/prime_table.rs` and the Makefile to reflect this.

4. Add a new test that generates random numbers with exclusively
   large (14 to 50 bit) prime factors. This exercises the possible
   overflow paths.

5. Add another new test that checks the `is_prime()` function against
   a few dozen 64-bit primes. Again this is to exercise possible
   overflow paths.
2015-05-08 00:06:35 -04:00
Joseph Crail
dfaee63cd3 Remove unused feature from cat. 2015-05-07 23:02:47 -04:00
kwantam
7565c27c00 fixed sleep 2015-05-07 18:13:40 -04:00
Camille TJHOA
d8f58305d6 new io cksum (includes BufReader fix)
closes kwantam/coreutils#1 via cherry-pick
2015-05-07 18:13:40 -04:00
kwantam
d89fbedf12 fix shuf 2015-05-07 18:13:39 -04:00
kwantam
4390e4ffa6 fix tac 2015-05-07 18:13:39 -04:00
kwantam
9a806346a9 add test for factor
Add a test for `factor`.

This commit also pulls factor's Sieve implementation into its own module
so that the factor test can use it.

Finally, slight refactoring for clarity in gen_table.rs.
2015-05-07 18:13:39 -04:00
kwantam
cab4f8d570 fix test 2015-05-07 18:12:32 -04:00
kwantam
1c93a793e9 fix touch 2015-05-07 18:12:32 -04:00
kwantam
6c4e967fc6 fix and slight optimization for factor
This commit builds upon @wikol's Pollard rho implementation.
It adds the following:

1. A generator for prime inverse tables. With these, we can do
   very fast divisibility tests (a single multiply and comparison)
   for small primes (presently, the first 1000 primes are in the
   table, which means all numbers of ~26 bits or less can be
   factored very quickly.

2. Always try prime inverse tables before jumping into Pollard's
   rho method or using trial division.

3. Since we have eliminated all small factors by the time we're
   done with the table division, only use slow trial division when
   the number is big enough to cause overflow issues in Pollard's
   rho, and jump out of trial division and into Pollard's rho as
   soon as the number is small enough.

4. Updates the Makefile to regenerate the prime table if it's not
   up-to-date.
2015-05-07 18:12:32 -04:00
Wiktor Kuropatwa
06b70877db factor: Rho-Pollard factorization implementation 2015-05-07 18:12:32 -04:00
kwantam
cee1837879 slight clarification / refactoring in unexpand
This keeps equivalent functionality but makes the code slightly cleaner.
Also added one more test case.
2015-05-07 18:12:32 -04:00
Joseph Crail
b00a49eab2 Unescape all special characters in delimiter list. 2015-05-07 16:50:54 -04:00
Joseph Crail
773eeb6d5e Update paste to nightly build. 2015-05-07 16:49:07 -04:00
Heather
22093d1e5a Merge pull request #574 from ctjhoa/master
Update comm to new_io
2015-05-07 07:42:23 +03:00
Joseph Crail
500bbbfa83 Fix env and add tests.
I updated env to use the nightly build. I also added several tests.
2015-05-06 23:59:58 -04:00
Camille TJHOA
53f62cdd6f Update comm to new_io 2015-05-07 01:05:30 +02:00
Heather
1f2b68251f Merge pull request #573 from jbcrail/fix-link-sum
Fix link and sum.
2015-05-07 00:21:09 +03:00
Heather
5ec1c7bea4 Merge pull request #570 from jbcrail/fix-sort-test
Fix failing test for sort.
2015-05-07 00:19:53 +03:00
Joseph Crail
0c883155f5 Fix sum. 2015-05-06 14:12:30 -04:00
Joseph Crail
6911c7e2ce Fix link. 2015-05-06 13:38:45 -04:00
Heather
7c732bcefe Merge pull request #571 from jbcrail/fix-cp
Fix cp.
2015-05-06 07:43:16 +03:00
Joseph Crail
b854a3161a Fix realpath and relpath.
I used the new Path/PathBuf/PathExt libraries.
2015-05-06 00:14:13 -04:00
Joseph Crail
c31ad75226 Fix cp.
I used the new File/Path libraries. The canonicalize method made much of
paths_refer_to_same_file() redundant.
2015-05-05 19:42:38 -04:00
Joseph Crail
b809af601a Fix failing test for sort.
The sorted values were not outputted using a newline.
2015-05-05 19:39:30 -04:00
Joseph Crail
cec0a29b93 Rewrite tee.
The utility need a substantial rewrite due to library changes and
lifetime issues. I needed to implement the MultiWriter struct since it
was no longer available.
2015-05-05 00:08:54 -04:00
Heather
15acf2a2b5 Merge pull request #566 from jbcrail/update-tty
Update tty and ignore build directories.
2015-05-04 08:32:26 +03:00
Joseph Crail
b0f531c7a3 Fix sort.
Minor corrections: upgrade to new libraries, remove unused features, use
new slicing syntax.
2015-05-03 17:42:01 -04:00
Joseph Crail
6de22f91a9 Update tty's options to conform to GNU version. 2015-05-03 17:11:42 -04:00
Michael Gehring
88ab6cfff7 Merge pull request #563 from jbcrail/fix-printenv
Fix printenv.
2015-05-03 11:49:13 +02:00
Joseph Crail
965a770841 Remove quotes from current directory. 2015-05-02 21:05:30 -04:00
Joseph Crail
c4ae971e8c Fix hostid and pwd.
Minor library upgrades and whitespace corrections.
2015-05-01 22:00:53 -04:00
Joseph Crail
930896bac1 Fix printenv.
Minor corrections and upgrade to new env variable module.
2015-05-01 15:54:49 -04:00
Joseph Crail
c7d07315b8 Fix groups and logname.
Minor upgrades and whitespace corrections.
2015-04-30 17:56:35 -04:00
Joseph Crail
3465525d55 Fix tty.
I made minor corrections to upgrade to Rust nightly build.
2015-04-30 17:06:38 -04:00
Alex Lyon
4a6b7d33cb Merge pull request #557 from jbcrail/fix-truncate
Fix truncate and related tests.
2015-04-29 18:50:05 -07:00
Joseph Crail
27947c9d2d Fix dirname. 2015-04-29 21:20:08 -04:00
Joseph Crail
5ec7f28625 Fix truncate and related tests. 2015-04-29 19:23:50 -04:00
Joseph Crail
c6cfca8366 Remove redundant length checks. 2015-04-29 02:37:29 -04:00
Joseph Crail
3b09af815d Fix head and tail.
I upgraded to the recent Rust release. The only major change was the
reduction of the sleep millisecond resolution from u64 to u32 (this
matches the thread::sleep_ms() method).
2015-04-29 02:37:29 -04:00
kwantam
91827a594a fix tr and its test
In addition, this commit substantially reduces the number
of allocations that tr does when building the substitution
tables.
2015-04-29 01:31:16 -04:00
kwantam
8e2788bd39 fix/rewrite expand
This is a reworked version of expand. I did this for two main
reasons:

1. The previous version assumed the input was UTF-8. This
   version is compatible with both UTF-8 and non-UTF-8 inputs.

2. This version has a new flag, -U, which forces expand to
   treat input as 8-bit ASCII rather than interpreting it
   as UTF-8. This might be handy in some cases.
2015-04-29 01:09:27 -04:00
kwantam
feee266b20 fix/rewrite unexpand and its tests
This is a reworked version of unexpand. I did this for two main
reasons:

1. The previous version of unexpand had issues correctly computing
   tabstops when the `-a` flag was supplied.

2. The previous version assumed the input was UTF-8. This version works
   with non-UTF-8 inputs.

3. This version has a new flag, -U, which forces unexpand to
   treat input as 8-bit ASCII rather than interpreting it
   as UTF-8. This might be handy in some cases.
2015-04-29 01:09:27 -04:00
kwantam
ec4e3a60e4 fix unlink 2015-04-29 01:09:26 -04:00
kwantam
d1f594eb68 remove box_syntax feature from fmt, base64, cat 2015-04-29 01:09:26 -04:00
Joseph Crail
2c4fd7ae23 Fix tsort.
I upgraded to the recent Rust release.
2015-04-29 00:01:46 -04:00
kwantam
2e237dd6bb fix uname 2015-04-27 22:06:19 -04:00
kwantam
1d62f35b45 fix uptime 2015-04-27 22:00:19 -04:00
kwantam
a122849e7c fix wc 2015-04-27 18:19:56 -04:00
kwantam
143aea72ee fix users 2015-04-27 17:38:39 -04:00
kwantam
09937b66b9 fix whoami 2015-04-27 17:31:53 -04:00
kwantam
8cd81ec418 update uniq 2015-04-27 15:27:15 -04:00
kwantam
05520e69cb clean up #![features]
For the most part, this commit removes the `collections` feature.
In some places I've removed other features where the effort to do
so was pretty low.
2015-04-27 15:27:15 -04:00
kwantam
de28072140 update yes
This commit makes `yes` build on recent nightly.
2015-04-27 15:27:15 -04:00
kwantam
970857ccbe working chroot implementation 2015-04-27 00:06:12 -04:00
kwantam
664f7d474e update chroot (not quite working yet) 2015-04-26 16:12:19 -04:00
kwantam
06f1b38c91 update chmod for latest stdlib changes 2015-04-26 16:12:19 -04:00
Camille TJHOA
c8365f78b4 chroot new_io 2015-04-26 20:23:29 +02:00
Camille TJHOA
d990efff83 chmod new_io 2015-04-26 20:03:37 +02:00