Commit graph

2288 commits

Author SHA1 Message Date
Michael Gehring
14b1313eaf comm: fix EOF detection 2015-11-28 20:25:16 +01:00
Heather
0d8b6cb73c Merge pull request #733 from jbcrail/off-by-one-error
cut: fix off-by-one error for range calculation
2015-11-28 10:23:08 +04:00
Joseph Crail
e3eb633ac9 cut: fix off-by-one error for range calculation
When determining the range from which to select portions of a line, the
upper limit of the range is a usize. The maximum upper value is
usize::MAX, but at one point this value is incremented, causing an
overflow. By setting the maximum upper value to usize::MAX-1, the bug is
averted. Since the upper limit of the range is an index (thus, ranging
from 0 to 2^64-1 for 64-bit platforms), the maximum usize should not be
reached.
2015-11-28 00:42:35 -05:00
Joseph Crail
bdf891c630 Merge pull request #732 from ebfe/travis-cargo
travis: switch to cargo build/test
2015-11-27 17:41:12 -05:00
Joseph Crail
2e4b741dd8 Merge pull request #731 from ebfe/fix-warnings
Remove deprecated lint
2015-11-27 17:40:10 -05:00
Michael Gehring
58f89454c7 travis: switch to cargo build/test 2015-11-27 22:25:16 +01:00
Michael Gehring
a773db7325 Remove deprecated lint 2015-11-27 22:23:06 +01:00
Michael Gehring
c60707f5e6 Merge pull request #730 from jbcrail/test-fail
test: fix namespace and broken test
2015-11-27 22:01:45 +01:00
Joseph Crail
012414c49f test: fix namespace and broken test
I separated test's main() into a separate file to override Cargo's
requirement for matching crate names. I had to update the build command
to use a special extern reference for test.

Fixes issues caused by #728.
2015-11-27 15:35:20 -05:00
Joseph Crail
b469b2e316 Merge pull request #729 from ebfe/fix-true
Fix true
2015-11-27 15:34:16 -05:00
Michael Gehring
b1405588ce Fix multicall true 2015-11-27 11:14:25 +01:00
Michael Gehring
282df37a02 Merge pull request #728 from jbcrail/fix-namespace-collision
Fix namespace collision for test.
2015-11-27 10:07:33 +01:00
Joseph Crail
d4e0ea41a3 Fix namespace collision for test.
To avoid linking issues with Rust's libtest, the crate for the test
utility was changed to 'uutest'. However, the user doesn't need to see
this so a few hoops were jumped through to make this transparent.

I also updated the make rules to build the individual features first and
then uutils. This makes 'make && make test' look more organized.
2015-11-27 01:54:18 -05:00
Michael Gehring
cfadcfaf64 Merge pull request #727 from jbcrail/make-cleanup
make: fix build error and remove unused aliases
2015-11-27 03:56:25 +01:00
Joseph Crail
7ef6bdbe81 Compile only against needed dependencies. 2015-11-26 17:51:31 -05:00
Joseph Crail
927049548c Clean up whitespace and remove unused aliases. 2015-11-26 17:13:41 -05:00
Joseph Crail
340ad317e1 Remove syntax error from build. 2015-11-26 17:02:55 -05:00
Michael Gehring
3a591bfe2c Merge pull request #726 from jbcrail/fix-make
Fix make to fail on first build and/or test errors.
2015-11-26 07:56:24 +01:00
Joseph Crail
2d41e6641c Set build/test make rules to be fail fast. 2015-11-25 17:33:07 -05:00
Joseph Crail
089d15c4ca Remove non-fail-fast build and test rules. 2015-11-25 17:32:02 -05:00
Heather
cda60eb3d5 Merge pull request #725 from ebfe/versions
Switch to cargo version numbers
2015-11-25 14:21:16 +04:00
Michael Gehring
ca16e66a55 switch to cargo version numbers 2015-11-25 10:58:49 +01:00
Michael Gehring
9365e100d9 Merge pull request #723 from jbcrail/cleanup
Fix whitespace, unused file, and warnings.
2015-11-25 10:20:46 +01:00
Heather
196254be3b Merge pull request #722 from ebfe/fix-sum
sum: fix tests
2015-11-25 01:18:34 -08:00
Joseph Crail
55e5327573 Use name/version when showing hostname's usage. 2015-11-25 04:05:12 -05:00
Joseph Crail
80f83ce15d Remove unused file. 2015-11-25 04:05:12 -05:00
Joseph Crail
412025b45a Fix whitespace and sort order of tests. 2015-11-25 04:05:12 -05:00
Michael Gehring
e7398b3ca7 sum: fix sysv_stdin testcase 2015-11-25 09:58:58 +01:00
Michael Gehring
cdbae736f1 sum: use wrapping_add to avoid overflow panics 2015-11-25 09:58:58 +01:00
Joseph Crail
6e4392779f Merge pull request #721 from ebfe/truefalse
Add true/false back to multicall binary
2015-11-25 03:29:01 -05:00
Michael Gehring
ef5e865089 Add true/false back to multicall binary 2015-11-25 08:47:33 +01:00
Michael Gehring
b80f3b5f9d Merge pull request #720 from jbcrail/fix-test-scaffold
Fix test scaffolding after Cargo updates.
2015-11-25 08:12:24 +01:00
Joseph Crail
c0c8d3ecec Fix test scaffolding after Cargo updates. 2015-11-25 01:50:57 -05:00
Heather
2c1c5606f9 Merge pull request #718 from jbcrail/uucore
Split utility files into separate library.
2015-11-24 20:46:26 -08:00
Joseph Crail
ca1074201f Split utility files into separate library.
Everything in src/common has been moved to src/uucore. This is defined
as a Cargo library, instead of directly included. This gives us
flexibility to make the library an external crate in the future.

Fixes #717.
2015-11-24 22:20:27 -05:00
Heather
072f48f039 Merge pull request #715 from nathanross/cargo-idioms
Use cargo idioms for simple, intuitive builds and flexible tests
2015-11-24 05:37:00 -08:00
Nathan Ross
502957dc3e use cargo idioms to manage dependency resolution and compilation 2015-11-23 02:04:15 -05:00
Nathan Ross
a21c54e2cd rewrite tests for cargo compat, decoupled directory, output handling 2015-11-23 02:04:15 -05:00
Nathan Ross
b20b2cca19 update uses of libc 0.1.x and deprecated stdlib uses 2015-11-23 02:04:15 -05:00
Heather
fa34096bb8 Merge pull request #712 from jbcrail/add-link-tests
Add tests for link.
2015-11-02 10:40:24 +04:00
Joseph Crail
10a2c5c224 Add tests for link. 2015-11-02 01:13:34 -05:00
Heather
1f7f3ad535 Merge pull request #711 from jbcrail/add-rmdir-tests
Add tests for rmdir.
2015-11-02 01:02:56 +04:00
Joseph Crail
3b5c776675 Add tests for rmdir.
I also adjusted error message to conform to GNU implementation.
2015-11-01 15:31:48 -05:00
Heather
510b024d0f Merge pull request #710 from jbcrail/rm-deprecated
Replace deprecated lines_any() with lines().
2015-10-31 11:38:50 +04:00
Heather
a102d63be5 Merge pull request #709 from jbcrail/rm-parentheses
Remove unnecessary parentheses.
2015-10-31 11:38:42 +04:00
Joseph Crail
c58e1ba3d8 Replace deprecated lines_any() with lines(). 2015-10-31 02:50:46 -04:00
Joseph Crail
4121d1e25d Remove unnecessary parentheses. 2015-10-31 02:32:55 -04:00
Heather
57839e4703 Merge pull request #708 from RGafiyatullin/impl-expr-pre-merge-2
Implement expr.
2015-10-10 11:29:02 +04:00
Roman Gafiyatullin
7b54410557 expr: prefix operators length/1, index/3 and substr/3 2015-10-09 19:26:51 +03:00
Roman Gafiyatullin
092e4d1ed4 Implement expr.
Implemented as follows:

    Usage: expr EXPRESSION
      or:  expr OPTION

          --help     display this help and exit
          --version  output version information and exit

    Print the value of EXPRESSION to standard output.  A blank line below
    separates increasing precedence groups.  EXPRESSION may be:

      ARG1 | ARG2       ARG1 if it is neither null nor 0, otherwise ARG2

      ARG1 & ARG2       ARG1 if neither argument is null or 0, otherwise 0

      ARG1 < ARG2       ARG1 is less than ARG2
      ARG1 <= ARG2      ARG1 is less than or equal to ARG2
      ARG1 = ARG2       ARG1 is equal to ARG2
      ARG1 != ARG2      ARG1 is unequal to ARG2
      ARG1 >= ARG2      ARG1 is greater than or equal to ARG2
      ARG1 > ARG2       ARG1 is greater than ARG2

      ARG1 + ARG2       arithmetic sum of ARG1 and ARG2
      ARG1 - ARG2       arithmetic difference of ARG1 and ARG2

      ARG1 * ARG2       arithmetic product of ARG1 and ARG2
      ARG1 / ARG2       arithmetic quotient of ARG1 divided by ARG2
      ARG1 % ARG2       arithmetic remainder of ARG1 divided by ARG2

      STRING : REGEXP   [NOT IMPLEMENTED] anchored pattern match of REGEXP in STRING

      match STRING REGEXP        [NOT IMPLEMENTED] same as STRING : REGEXP
      substr STRING POS LENGTH   [NOT IMPLEMENTED] substring of STRING, POS counted from 1
      index STRING CHARS         [NOT IMPLEMENTED] index in STRING where any CHARS is found, or 0
      length STRING              [NOT IMPLEMENTED] length of STRING
      + TOKEN                    interpret TOKEN as a string, even if it is a
                                   keyword like 'match' or an operator like '/'

      ( EXPRESSION )             value of EXPRESSION

    Beware that many operators need to be escaped or quoted for shells.
    Comparisons are arithmetic if both ARGs are numbers, else lexicographical.
    Pattern matches return the string matched between \( and \) or null; if
    \( and \) are not used, they return the number of characters matched or 0.

    Exit status is 0 if EXPRESSION is neither null nor 0, 1 if EXPRESSION is null
    or 0, 2 if EXPRESSION is syntactically invalid, and 3 if an error occurred.

    Environment variables:
    	* EXPR_DEBUG_TOKENS=1   dump expression's tokens
    	* EXPR_DEBUG_RPN=1      dump expression represented in reverse polish notation
    	* EXPR_DEBUG_SYA_STEP=1 dump each parser step
    	* EXPR_DEBUG_AST=1      dump expression represented abstract syntax tree
2015-10-09 12:31:25 +03:00