<feed xmlns='http://www.w3.org/2005/Atom'>
<title>coreutils/src/copy.c, branch v8.22</title>
<subtitle>Mirror of https://https.git.savannah.gnu.org/git/coreutils.git/
</subtitle>
<id>https://git.shady.money/coreutils/atom?h=v8.22</id>
<link rel='self' href='https://git.shady.money/coreutils/atom?h=v8.22'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/'/>
<updated>2013-12-05T00:18:36Z</updated>
<entry>
<title>selinux: fix --context=CTX for cp and diagnose defaultcon() errors</title>
<updated>2013-12-05T00:18:36Z</updated>
<author>
<name>Pádraig Brady</name>
<email>P@draigBrady.com</email>
</author>
<published>2013-12-04T19:10:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=0013de3e603162081c4464ea1f7ad3285f633d78'/>
<id>urn:sha1:0013de3e603162081c4464ea1f7ad3285f633d78</id>
<content type='text'>
* src/selinux.h (ignorable_ctx_err): A new function used
to determine if a warning should be given after a call
to defaultcon() or restorecon().
* src/cp.c (main): Fix the setfscreatecon() call to use
the argument passed by the user.
* src/mkdir.c (make_ancestor): Show all but "ignoreable" errors
from defaultcon() and restorecon().
* tests/misc/selinux.sh: Add a test run as root in selinux enforcing
mode, to ensure cp --context=invalid is honored and fails immediately.
</content>
</entry>
<entry>
<title>selinux: adjust utils to run restorecon with -Z</title>
<updated>2013-11-27T14:19:32Z</updated>
<author>
<name>Pádraig Brady</name>
<email>P@draigBrady.com</email>
</author>
<published>2013-11-27T12:26:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=7958a4a4fe234f9787daf178a60bc83449605dac'/>
<id>urn:sha1:7958a4a4fe234f9787daf178a60bc83449605dac</id>
<content type='text'>
cp, mv, install, mkdir, mkfifo, mknod are adjusted so that:
 -Z no longer accepts an argument.
 -Z or --context without an argument do not warn without SELinux.
 --context with an argument will warn without SELinux.

* src/local.mk: Reference the new selinux module where required.
* src/system.h: Make the argument to --context optional.
* src/mkdir.c: Likewise.  Also handle the SMACK case for --context.
Note we currently silently ignore -Z with SMACK.
* src/mkfifo.c: Likewise.
* src/mknod.c: Likewise.
* src/install.c: Likewise.  Note install(1) by default already
set the context for target files to their system default,
albeit with an older method.  Use the -Z option to select between
the old and new context restoration behavior, and document
the differences and details for how context restoration
is done in new and old methods, with a view disabling the
old method entirely in future.
* src/cp.c: Make the argument to --context optional.
Note -Z implies --no-preserve=context.  I.E. -Z overrides
that aspect of -a no matter what order specified.
(struct cp_options): Document the context handling options.
(main): Check/adjust option combinations after all
options are processed, to both simplify processing
and to make handling independent of order of options
on the command line.  Also improve the diagnostics
from a failed call to setfscreatecon().
(set_process_security_ctx): A new function,
refactored to set the default context from the source file,
or with the type adjusted as per the system default for
the destination path.
(set_file_security_ctx): A new function refactored to
set the security context of an existing file, either based on
the process context or the default system context for a path.
(copy_internal): Use the refactored functions to simplify
error handling and consistently fail or warn as needed.
(copy_reg): Likewise.
(copy_internal): With --preserve=context, also copy
context from non regular files.  Note for directories this may
impact the copying of subsequent files to that directory?
(copy_attr): If we're handling SELinux explicitly,
then exclude to avoid the redudant copy with --preserve=context,
and the problematic copy with -Z.  Note SELinux attribute exclusion
also now honors cp -a --no-preserve=context.  Note there was a
very small window over 10 years ago, where attr_copy_file was
available, while attr_copy_check_permissions was not, so we
don't bother adding an explicit m4 check for the latter function.
* src/mv.c: Support --context, but don't allow specifying an argument.
* src/chcon.c: Adjust a comment to be specific to SELinux.
* src/runcon.c: Likewise.
* src/copy.c: Honor the context settings to "restorecon" as appropriate.
* src/copy.h: Add a new setting to select "restorecon" functionality.
* tests/mkdir/selinux.sh: s/-Z/--context=/
* tests/cp/cp-a-selinux.sh: Augment this test with cases
testing basic -Z functionality, and also test the various
invalid option combinations and option precedence.
* tests/mkdir/restorecon.sh: Add a new test for the
more involved mkdir -Z handling, since the directory changing
and non existent directories need to be specially handled.
Also check the similar but simpler handling of -Z by mk{nod,fifo}.
* tests/local.mk: Reference the new test.
* doc/coreutils.texi (cp invocation): Update as per interface changes.
(mv invocation): Likewise.
(install invocation): Likewise.
(mkfifo invocation): Likewise.
(mknod invocation): Likewise.
(mkdir invocation): Likewise.
* NEWS: Mention the new feature and change in behavior.
</content>
</entry>
<entry>
<title>cp: fix --link regarding the dereferencing of symbolic links</title>
<updated>2013-11-07T22:45:22Z</updated>
<author>
<name>Gian Piero Carrubba</name>
<email>gpiero@rm-rf.it</email>
</author>
<published>2013-11-07T22:35:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=bf6bf52dce37832b03ecfbe1b3a3b104f532df42'/>
<id>urn:sha1:bf6bf52dce37832b03ecfbe1b3a3b104f532df42</id>
<content type='text'>
* src/copy.c (create_hard_link): Add a bool 'dereference' parameter,
and pass AT_SYMLINK_FOLLOW as 'flags' to linkat() when dereference
is true.
(should_dereference): Add new 'bool' function to determine if a
file should be dereferenced or not.
(copy_internal): Use the above new should_dereference() and remember
its return value in a new local bool 'dereference' variable.  Use that
in all three calls to create_hard_link().
* src/cp.c (main): after parsing the options, if x.dereference is
still DEFEF_UNDEFINED and the x.recursive is true, then only set
x.dereference to DEREF_NEVER iff --link was not specified.
* doc/coreutils.texi (cp invocation): Mention that cp(1) does not
follow symbolic links in the source when --link is specified.
Likewise in the description of the -R option when used together with
that option.
* tests/cp/same-file.sh: Adapt the expected results for the -fl,
the -bl and the -bfl tests.
* tests/cp/link-deref.sh: Add a new test.
* tests/local.mk (all_tests): Reference the above new test.
* NEWS (Changes in behavior): Mention the change.

This fixes http://bugs.gnu.org/15173

Co-authored-by: Bernhard Voelker &lt;mail@bernhard-voelker.de&gt;
</content>
</entry>
<entry>
<title>maint: update out of date confusing comments</title>
<updated>2013-09-01T17:44:04Z</updated>
<author>
<name>Pádraig Brady</name>
<email>P@draigBrady.com</email>
</author>
<published>2013-09-01T17:40:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=0603ff3784c353cf096a02b825f76fd3a08ac756'/>
<id>urn:sha1:0603ff3784c353cf096a02b825f76fd3a08ac756</id>
<content type='text'>
* src/copy.c (copy_internal): Change mention of the removed --reply=no
option, to the similar in this context --no-clobber.
* src/sort.c: SI and IEC suffixes can now be mixed when --human-numeric.
</content>
</entry>
<entry>
<title>mv: replace empty directories in cross file system move</title>
<updated>2013-07-25T15:45:02Z</updated>
<author>
<name>Ken Booth</name>
<email>ken@booths.org.uk</email>
</author>
<published>2013-07-02T00:06:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=2bdb74ec1a453f6c6084d042e573de436ec205f3'/>
<id>urn:sha1:2bdb74ec1a453f6c6084d042e573de436ec205f3</id>
<content type='text'>
src/copy.c (copy_internal): Use rmdir() rather than unlink()
when the source is a directory, so that empty directories
are replaced in the destination as per POSIX.
* tests/mv/part-rename.sh: Augment with various combinations.
* NEWS: Mention the bug fix.
Fixes http://bugs.gnu.org/14763
</content>
</entry>
<entry>
<title>maint: add FIXME comment</title>
<updated>2013-05-12T02:22:54Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2013-05-12T02:21:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=8a2d91492cbd2224ff9cdb28163836cb34df2da1'/>
<id>urn:sha1:8a2d91492cbd2224ff9cdb28163836cb34df2da1</id>
<content type='text'>
</content>
</entry>
<entry>
<title>copy: ensure the correct root ID is checked on all platforms</title>
<updated>2013-02-20T04:05:30Z</updated>
<author>
<name>Joachim Schmitz</name>
<email>jojo@schmitz-digital.de</email>
</author>
<published>2013-02-19T11:36:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=6229654741554561952c6106f75681e4382cc890'/>
<id>urn:sha1:6229654741554561952c6106f75681e4382cc890</id>
<content type='text'>
* src/copy.c (copy_reg): Check ROOT_UID rather than 0,
which is significant on HP-NonStop.
</content>
</entry>
<entry>
<title>maint: cleanup up various uses of __attribute__</title>
<updated>2013-02-20T04:04:25Z</updated>
<author>
<name>Pádraig Brady</name>
<email>P@draigBrady.com</email>
</author>
<published>2013-02-19T10:58:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=31861f663a440df498bdb7788fa43aa9d03133c5'/>
<id>urn:sha1:31861f663a440df498bdb7788fa43aa9d03133c5</id>
<content type='text'>
* src/cfg.mk (sc_prohibit-gl-attributes): Disallow the __attribute()
form without trailing underscores as that is not elided where required.
Also ensure we use gnulib macros rather than defining our own.
* src/system.h: Remove gnulib provided macros.
* src/chown-core.c: Likewise.
* src/chroot.c: Likewise.
* src/copy.c: Likewise.
* src/csplit.c: Likewise.
* src/dd.c: Likewise.
* src/expr.c: Likewise.
* src/extent-scan.c: Likewise.
* src/factor.c: Likewise.
* src/ls.c: Likewise.
* src/od.c: Likewise.
* src/paste.c: Likewise.
* src/ptx.c: Likewise.
* src/sort.c: Likewise.
* src/stat.c: Likewise.
* src/stty.c: Likewise.
* src/system.h: Likewise.
* src/tac.c: Likewise.
* src/test.c: Likewise.
* src/tsort.c: Likewise.
</content>
</entry>
<entry>
<title>maint: improve error messages upon failed read, write, access, close</title>
<updated>2013-02-06T15:57:34Z</updated>
<author>
<name>Benno Schulenberg</name>
<email>bensberg@justemail.net</email>
</author>
<published>2013-01-04T21:45:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=a1ee5cd714c0825b0244d09bbaa0a61c883ac18f'/>
<id>urn:sha1:a1ee5cd714c0825b0244d09bbaa0a61c883ac18f</id>
<content type='text'>
Note we use "failed to {access,close}" for those single operations,
and "error {read,writ}ing" for those partial operation failures.

* src/copy.c: Improve error messages for failing read, write and close.
* src/cp.c: Improve error messages for failing access.
* src/dd.c: Improve error messages for failing read, write and open.
* src/head.c: Improve error message for failing close.
* src/install.c: Improve error messages for failing access.
* src/ln.c: Likewise.
* src/mv.c: Likewise.
* src/touch.c: Improve error message for failing close.
* src/truncate.c: Likewise.
</content>
</entry>
<entry>
<title>maint: update all copyright year number ranges</title>
<updated>2013-01-01T03:51:20Z</updated>
<author>
<name>Jim Meyering</name>
<email>jim@meyering.net</email>
</author>
<published>2013-01-01T02:54:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=77da73c75432f3c5b4beebae7b0797a1e33160bc'/>
<id>urn:sha1:77da73c75432f3c5b4beebae7b0797a1e33160bc</id>
<content type='text'>
Run "make update-copyright", but then also run this,
  perl -pi -e 's/2\d\d\d-//' tests/sample-test
to make that one script use the single most recent year number.
</content>
</entry>
</feed>
