Skip to content

Implement install#914

Merged
Cynede merged 10 commits intouutils:masterfrom
beneills:implement-install
Jul 14, 2016
Merged

Implement install#914
Cynede merged 10 commits intouutils:masterfrom
beneills:implement-install

Conversation

@beneills
Copy link
Copy Markdown
Contributor

This pull request implements install, with basic functionality.

Included:

  • install is now built as a utility
  • install file1 file2 directory/ works
  • install -d comp1 comp2 works
  • install --mode=345 file directory/ works
  • all command line options from GNU are displayed in help
  • all unimplemented options are marked in help
  • all unimplemented options give nice error

Testing:

Notes:

  • all functions are documented for rustdoc
  • we based the skeleton off mv
  • a minimum libc version of 0.2 is specified for install
  • a large amount full implementation code would already exist in other utilities
  • for now, some code from chmod has been copied into a module

Questions before merge:

  • is there a good/recommended way to share functional code between utilities?
  • is the dependency change acceptable?

beneills added 9 commits July 12, 2016 20:56
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.
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.
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.
Test this with one integration test.  Also document functions
and add an '(unimplemented)' marker to some arguments in help.
Tested in two integration test:

 - One creating three component directories
 - One trying to create an already existing directory
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.
@beneills
Copy link
Copy Markdown
Contributor Author

If desired, it's an easy change to comment out unimplemented arguments.

Comment thread Makefile Outdated
hostid \
hostname \
id \
install \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tab / spaces

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@Cynede Cynede merged commit 40ae11b into uutils:master Jul 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants