<feed xmlns='http://www.w3.org/2005/Atom'>
<title>coreutils/src/copy.c, branch v7.3</title>
<subtitle>Mirror of https://https.git.savannah.gnu.org/git/coreutils.git/
</subtitle>
<id>https://git.shady.money/coreutils/atom?h=v7.3</id>
<link rel='self' href='https://git.shady.money/coreutils/atom?h=v7.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/'/>
<updated>2009-04-27T11:33:47Z</updated>
<entry>
<title>copy.c: factor out test for errno value indicating "unsupported"</title>
<updated>2009-04-27T11:33:47Z</updated>
<author>
<name>Jim Meyering</name>
<email>meyering@redhat.com</email>
</author>
<published>2009-04-27T09:35:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=e0cf592f48b4e67dc31d0482ae4f4dbc820e883e'/>
<id>urn:sha1:e0cf592f48b4e67dc31d0482ae4f4dbc820e883e</id>
<content type='text'>
* src/copy.c (errno_unsupported): New function.
(copy_attr_error, copy_internal): Use it.
</content>
</entry>
<entry>
<title>cp -a: diagnose failure when preserving xattr/context required</title>
<updated>2009-04-27T11:33:42Z</updated>
<author>
<name>Ondřej Vašík</name>
<email>ovasik@redhat.com</email>
</author>
<published>2009-04-24T12:29:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=1fa226772cb25c9b2bc17480ddb30bb3dd569951'/>
<id>urn:sha1:1fa226772cb25c9b2bc17480ddb30bb3dd569951</id>
<content type='text'>
* src/copy.c (copy_attr_by_fs): Always print diagnostics when preserving
xattrs is required.
(copy_attr_by_name): Likewise.
(copy_reg): Always print diagnostics when preserving SELinux
context is required.
(copy_internal): Likewise.  Also, do not ignore ENOTSUP and ENODATA
errors when preserving SELinux context is required.
* NEWS (Bug fixes): Mention it.
</content>
</entry>
<entry>
<title>mv: ignore xattr-preservation failure when not supported by filesystem</title>
<updated>2009-04-27T11:26:03Z</updated>
<author>
<name>Ondřej Vašík</name>
<email>ovasik@redhat.com</email>
</author>
<published>2009-04-17T09:00:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=941bd48235cceceb4f1c072e06a4bedd14b5e0b5'/>
<id>urn:sha1:941bd48235cceceb4f1c072e06a4bedd14b5e0b5</id>
<content type='text'>
*src/copy.c: Do not warn about xattr-preservation failure when xattrs
are not supported and preservation of xattrs is not explicitly required.
Reported by Eric Sandeen in http://bugzilla.redhat.com/496142
</content>
</entry>
<entry>
<title>cp: work around linux kernel bug: short-read != EOF on /proc</title>
<updated>2009-04-22T19:52:11Z</updated>
<author>
<name>Jim Meyering</name>
<email>meyering@redhat.com</email>
</author>
<published>2009-04-17T16:44:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=c74fbaefebe91ca60e3a8582613a3714c740df65'/>
<id>urn:sha1:c74fbaefebe91ca60e3a8582613a3714c740df65</id>
<content type='text'>
Remove the optimization that avoided up to 50% of cp's read syscalls.
Do not assume that a short read on a regular file indicates EOF.
When reading from a file in /proc on linux [at least 2.6.9 - 2.6.29]
into a 4k-byte buffer or larger, a short read does not
always indicate EOF.  For example, "cp /proc/slabinfo /tmp"
copies only 4068 of the total 7493 bytes.  This optimization
(25719a33154f0c62ea9881f0c79ae312dd4cec7a, Improve performance a bit
by optimizing away; 2005-11-24) appears to have been worth less than
a 2% speed-up (and usually much less), so the impact of removing it
is negligible.

* src/copy.c (copy_reg): Don't exit the loop early.
* tests/cp/proc-short-read: New test, lightly based on a suggestion
from Mike Frysinger, to exercise this fix.
* tests/Makefile.am (TESTS): Add cp/proc-short-read.
* NEWS (Improve robustness): Mention this change.
</content>
</entry>
<entry>
<title>cp: make -a option preserve xattrs, but with reduced diagnostics</title>
<updated>2009-03-11T16:32:44Z</updated>
<author>
<name>Ondřej Vašík</name>
<email>ovasik@redhat.com</email>
</author>
<published>2009-03-11T15:08:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=c160afe902c07f5052dbd97c726a997db7fa20c0'/>
<id>urn:sha1:c160afe902c07f5052dbd97c726a997db7fa20c0</id>
<content type='text'>
* copy.c (copy_attr_by_fd): Reduce xattr diagnostics for 'cp -a'.
(copy_attr_by_name): Likewise.
* cp.c (main): Preserve xattrs with -a option, when possible.
* doc/coreutils.texi: Document that xattrs are preserved with
cp -a, with no added diagnostics.
* NEWS: Mention the change.
* tests/misc/xattr: Add tests for 'cp --preserve=all' and 'cp -a'.
</content>
</entry>
<entry>
<title>cat,cp,mv,install,split: Set the minimum IO block size used to 32KiB</title>
<updated>2009-03-11T14:19:08Z</updated>
<author>
<name>Pádraig Brady</name>
<email>P@draigBrady.com</email>
</author>
<published>2009-03-06T22:30:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=55efc5f3ee485b3e31a91c331f07c89aeccc4e89'/>
<id>urn:sha1:55efc5f3ee485b3e31a91c331f07c89aeccc4e89</id>
<content type='text'>
This is following on from this change:
[02c3dc9d 2008-03-06 cat: use larger buffer sizes ...]
which increased the IO block size used by cat by 8 times,
but also capped it at 32KiB.
* NEWS: Mention the change in behavior.
* src/system.h: Add a new io_blksize() function that
returns the max of ST_BLKSIZE or 32KiB, as this was
seen as a good value for a minimum block size to use
to get good performance while minimizing system call overhead.
* src/cat.c: Use it.
* src/copy.c: ditto
* src/split.c: ditto
</content>
</entry>
<entry>
<title>cp: diagnose invalid "cp -rl dir dir" right away, once again</title>
<updated>2009-02-27T10:44:26Z</updated>
<author>
<name>Jim Meyering</name>
<email>meyering@redhat.com</email>
</author>
<published>2009-02-27T08:23:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=b50a4ae557d6ac479e659f685c8a8ff909e09393'/>
<id>urn:sha1:b50a4ae557d6ac479e659f685c8a8ff909e09393</id>
<content type='text'>
Running "mkdir dir; cp -rl dir dir" would create dir/dir/dir/...
rather than diagnosing the "copy-into-self" failure.

The easy fix would have been to revert this part of the change
[3ece0355 2008-11-09 cp: use far less memory in some cases]
that introduced the bug:

-         remember_copied (dst_name, dst_sb.st_ino, dst_sb.st_dev);
+         if (!x-&gt;hard_link)
+           remember_copied (dst_name, dst_sb.st_ino, dst_sb.st_dev);

However, that would have induced the failure of the new cp/link-heap
test, due to the added memory pressure of recording 10k dev/ino pairs.
And besides, I liked that improvement and wanted to keep it.

Now that it's obvious recording the just-created-directory dev/ino
needn't depend on the setting of hard_link, I realized it is necessary
to record the pair only for the first directory created for each
source command-line argument.

I made that change, then noticed the new test, cp -rl a d d, would pass
when run once, yet output the into-self diagnostic twice.  Also note
the side effect: it creates d/a and d/d.  However, running that same
command a second time, now with the modified directory, would fail.

That turned out to be due to the fact that although the first into-self
failure was detected in copy_dir, that function would continue copying
other entries regardless -- and that would make it fail (eventually)
with the unwanted recursion.

* src/copy.c (copy_internal): This function needed an indicator of
whether, for a give command line argument, it had already created its
first directory.  If so, no more need to record dev/ino pairs.  If this
is the first, then do record its pair.  Hence, the new parameter.
(copy_dir, copy): Update callers.
(copy_dir): Upon any into-self failure, break out of the loop.
* tests/cp/into-self: Test for the above.
Reported by Mikael Magnusson.
</content>
</entry>
<entry>
<title>cp: -a now preserves SELinux context, with reduced diagnostics</title>
<updated>2009-02-18T14:27:10Z</updated>
<author>
<name>Ondřej Vašík</name>
<email>ovasik@redhat.com</email>
</author>
<published>2009-02-17T14:53:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=8c243ff965d477a89582a1b329923516a4d64668'/>
<id>urn:sha1:8c243ff965d477a89582a1b329923516a4d64668</id>
<content type='text'>
* copy.c (copy_reg): Reduce SELinux context diagnostics for 'cp -a'.
(copy_internal): Likewise
* copy.h (cp_options): Add boolean reduce_diagnostics.
* cp.c (usage): Say that --archive (-a) behaves like -dR --preserve=all.
(cp_option_init): Initialize added reduce_diagnostics.
(main): Add reduce_diagnostics for the -a option, and preserve SELinux
context, if possible.
* mv.c (cp_options_init): Initialize new cp_options booleans.
* install.c (cp_option_init): Likewise.
* NEWS: Mention those behaviour changes.
* doc/coreutils.texi: Document --preserve=context, document that
diagnostics are not shown for failures of non-mandatory attributes
(just SELinux at the moment).
* tests/cp/cp-a-selinux: Check not only failures, but succesful use
of preserving SELinux context in cp.
</content>
</entry>
<entry>
<title>avoid spurious parentheses/arith-op-related warnings from newer gcc</title>
<updated>2009-02-05T13:53:10Z</updated>
<author>
<name>Jim Meyering</name>
<email>meyering@redhat.com</email>
</author>
<published>2009-02-05T13:53:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=8ed84c34388b3e475ece2f93ac22e25546503f16'/>
<id>urn:sha1:8ed84c34388b3e475ece2f93ac22e25546503f16</id>
<content type='text'>
* src/copy.c (set_owner): Use &amp;&amp; rather than &amp;.
* src/stty.c (main): Likewise.
* src/wc.c (wc): Likewise.
</content>
</entry>
<entry>
<title>cp/mv: add xattr support</title>
<updated>2009-01-29T12:26:07Z</updated>
<author>
<name>Kamil Dudka</name>
<email>kdudka@redhat.com</email>
</author>
<published>2009-01-23T11:17:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=0889381cbfdbb4895e6b8693d14c0f5c77bc85bc'/>
<id>urn:sha1:0889381cbfdbb4895e6b8693d14c0f5c77bc85bc</id>
<content type='text'>
This patch was originally written by Andreas GrÃ¼nbacher, nowadays
available at
http://www.suse.de/~agruen/coreutils/5.91/coreutils-xattr.diff

* bootstrap.conf: Add gnulib module verror.
* po/POTFILES.in: Add lib/verror.c.
* m4/xattr.m4: Check for libattr availability, new configure option
--disable-xattr.
* m4/prereq.m4: Require gl_FUNC_XATTR.
* src/Makefile.am: Link cp, mv and ginstall with libattr.
* src/copy.h: Add preserve_xattr and require_preserve_xattr to
cp_options.
* src/copy.c (copy_attr_error): New function to handle errors during
xattr copying.
(copy_attr_quote): New function to quote file name in error messages
printed by libattr.
(copy_attr_free): Empty function requested by libattr to free quoted
string.
(copy_attr_by_fd): New fd-oriented function to copy xattr.
(copy_attr_by_name): New name-oriented function to copy xattr.
(copy_reg, copy_internal): Call copy_extended_attributes function.
* src/cp.c (usage): Mention new --preserve=xattr option.
(decode_preserve_arg): Handle new --preserve=xattr option.
* src/mv.c: Always attempt to preserve xattr.
* src/install.c: Never attempt to preserve xattr.
* tests/misc/xattr: New test for xattr support in cp, mv and install.
* tests/Makefile.am: Add the new test to list.
* doc/coreutils.texi: Mention xattr support, new --preserve=xattr
option.
* NEWS: Mention the change.
</content>
</entry>
</feed>
