<feed xmlns='http://www.w3.org/2005/Atom'>
<title>coreutils/src/stat.c, branch v8.7</title>
<subtitle>Mirror of https://https.git.savannah.gnu.org/git/coreutils.git/
</subtitle>
<id>https://git.shady.money/coreutils/atom?h=v8.7</id>
<link rel='self' href='https://git.shady.money/coreutils/atom?h=v8.7'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/'/>
<updated>2010-11-13T10:40:52Z</updated>
<entry>
<title>stat: do not provide variable precision time stamps</title>
<updated>2010-11-13T10:40:52Z</updated>
<author>
<name>Jim Meyering</name>
<email>meyering@redhat.com</email>
</author>
<published>2010-11-13T07:02:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=4a8e9bf14c33b356680298d29f7321d82d4fde5d'/>
<id>urn:sha1:4a8e9bf14c33b356680298d29f7321d82d4fde5d</id>
<content type='text'>
* src/stat.c: Don't include fstimeprec.c.
(out_epoch_sec): Don't call fstimeprec.
* NEWS: Update description.
* doc/coreutils.texi: Likewise.
</content>
</entry>
<entry>
<title>stat: do not rely on undefined behavior in printf formats</title>
<updated>2010-11-07T01:09:44Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2010-11-06T20:57:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=ca9aa7596094c4af094edb7eb63648570d53c100'/>
<id>urn:sha1:ca9aa7596094c4af094edb7eb63648570d53c100</id>
<content type='text'>
* src/stat.c (digits, printf_flags): New static vars.
(make_format): New function.
(out_string, out_int, out_uint, out_uint_o, out_uint_x):
(out_minus_zero): Use it to avoid undefined behavior when invoking
printf.
(print_it): Check for invalid conversion specifications such as
%..X and %1-X, which would otherwise rely on undefined behavior
when invoking printf.
* tests/misc/stat-nanoseconds: Check that the "I" printf flag
doesn't mess up in the C locale, as it formerly did on non-GNU
hosts.
</content>
</entry>
<entry>
<title>stat: use e.g. %.3X instead of %X.%3:X for sub-second precision</title>
<updated>2010-11-06T14:24:49Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2010-11-06T02:35:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=c7375c236ca5fa23661388e9f9c41e8312eb0cce'/>
<id>urn:sha1:c7375c236ca5fa23661388e9f9c41e8312eb0cce</id>
<content type='text'>
* NEWS: Document this.
* doc/coreutils.texi (stat invocation): Likewise.
* gl/lib/fstimeprec.c, gl/lib/fstimeprec.h, gl/modules/fstimeprec:
* gl/modules/fstimeprec-tests, gl/tests/test-fstimeprec.c:
New files.
* bootstrap.conf (gnulib_modules): Add fstimeprec.
* src/stat.c: Include fstimeprec.h.  Don't include xstrtol.h.
(decimal_point, decimal_point_len): New static vars.
(main): Initialize them.
(epoch_sec, out_ns): Remove.
(out_int, out_uint): Now returns whatever printf returned.
(out_minus_zero, out_epoch_secs): New functions.
(print_stat): Use out_epoch_sec instead of out_ns and epoch_sec.
(print_stat, print_it, usage): Remove the %:X-style formats.
* tests/misc/stat-nanoseconds: Set TZ=UTC0 to avoid problems
with weird time zones.  Use a time stamp near the Epoch so that we
don't have to worry about leap seconds.  Redo test cases to match
new behavior.
* tests/touch/60-seconds: Change %Y.%:Y to %.9Y, to adjust to
new behavior.
</content>
</entry>
<entry>
<title>stat: revert %X-%Y-%Z change; use e.g., %:X to print fractional seconds</title>
<updated>2010-11-03T12:10:50Z</updated>
<author>
<name>Jim Meyering</name>
<email>meyering@redhat.com</email>
</author>
<published>2010-10-21T16:41:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=db42ae787de7165ee3a1bbf8d4988d0698d7c1df'/>
<id>urn:sha1:db42ae787de7165ee3a1bbf8d4988d0698d7c1df</id>
<content type='text'>
This reverts part of the recent commit 9069af45,
"stat: print timestamps to full resolution", which made %X, %Y, %Z
print floating point numbers.  We prefer to retain portability of
%X, %Y and %Z uses, while still providing access to full-resolution
time stamps via modified format strings.  Also make the new
%W consistent.
* src/stat.c: Include "xstrtol.h".
(print_it): Accept a new %...:[XYZ] format directive,
e.g., %:X, to print the nanoseconds portion of the corresponding time.
For example, %3.3:Y prints the zero-padded, truncated, milliseconds
part of the time of last modification.
(print_it): Update print_func signature to match.
(neg_to_zero): New helper function.
(epoch_time): Remove function; replace with...
(epoch_sec): New function; use timetostr.
(out_ns): New function.  Use "09" only when no other modifier
is specified.
(print_statfs): Change type of "m" to unsigned int,
now that it must accommodate values larger than 255.
(print_stat): Likewise.
Map :X to a code of 'X' + 256.  Likewise for Y, Z and W.
(usage): Update.
* tests/touch/60-seconds: Use %Y.%:Y in place of %Y.
* tests/misc/stat-nanoseconds: New file.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Changes in behavior): Mention this.
With improvements by Pádraig Brady.
Thanks to Andreas Schwab for raising the issue.
</content>
</entry>
<entry>
<title>stat: drop %C support when printing file system details</title>
<updated>2010-10-05T15:07:58Z</updated>
<author>
<name>Eric Blake</name>
<email>eblake@redhat.com</email>
</author>
<published>2010-10-05T15:02:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=b7459696dca96015688e82c81eaefad756b63ddc'/>
<id>urn:sha1:b7459696dca96015688e82c81eaefad756b63ddc</id>
<content type='text'>
* src/stat.c (print_statfs, usage): Drop %C, since it applies to
files, not file systems.
(out_file_context): Match style of other out_* functions.
(print_stat): Update caller.
* doc/coreutils.texi (stat invocation): Document %C.
* NEWS: Document the change.
</content>
</entry>
<entry>
<title>stat: adjust the printing of SELinux context</title>
<updated>2010-10-05T10:00:10Z</updated>
<author>
<name>Pádraig Brady</name>
<email>P@draigBrady.com</email>
</author>
<published>2010-10-05T07:40:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=77063bf819f44bbae4dd057e75d23ee72c728a63'/>
<id>urn:sha1:77063bf819f44bbae4dd057e75d23ee72c728a63</id>
<content type='text'>
* src/stat.c (default_format): Don't print SELinux context
when in file system (-f) mode, as the context is associated
with the file, not the file system.
Fix logic inversion, so that in terse mode, %C is included
only when is_selinux_enabled and not vice versa.
</content>
</entry>
<entry>
<title>stat: print SELinux context when available</title>
<updated>2010-10-01T21:27:27Z</updated>
<author>
<name>Eric Blake</name>
<email>eblake@redhat.com</email>
</author>
<published>2010-10-01T17:54:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=7a5ecae996a6a18ee9bdaf0ad50782247c53ec7b'/>
<id>urn:sha1:7a5ecae996a6a18ee9bdaf0ad50782247c53ec7b</id>
<content type='text'>
* src/stat.c (default_format): Include context when present.
* NEWS: Update blurb explaining the replacement for -Z.
</content>
</entry>
<entry>
<title>stat: optimize and translate default format strings</title>
<updated>2010-10-01T21:24:39Z</updated>
<author>
<name>Eric Blake</name>
<email>eblake@redhat.com</email>
</author>
<published>2010-10-01T17:44:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=2c14ec962a46ae53d39149112ae6902ed771d497'/>
<id>urn:sha1:2c14ec962a46ae53d39149112ae6902ed771d497</id>
<content type='text'>
Yes, this patch intentionally leaks the results of default_format(),
since it is called only twice, and since the results are in scope
until main() exits.  Not worth the extra code to pacify valgrind.

* src/stat.c (main): Hoist default format computation out of loop.
(do_statfs, do_stat): Move default format generation...
(default_format): ...into new function.  Allocate the result in
pieces, rather than repeating mostly-similar chunks.  Allow
translation of verbose format.  Pass a second format to do_stat,
for the one aspect of the default format that is conditional on
file type.
* NEWS: Document the translation aspect.
</content>
</entry>
<entry>
<title>stat: print timestamps to full resolution</title>
<updated>2010-10-01T16:43:41Z</updated>
<author>
<name>Eric Blake</name>
<email>eblake@redhat.com</email>
</author>
<published>2010-09-30T22:42:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=9069af45e691d1252c727da66aa4f3f3c7f1ea29'/>
<id>urn:sha1:9069af45e691d1252c727da66aa4f3f3c7f1ea29</id>
<content type='text'>
* src/stat.c (epoch_time): New function.
(print_stat): Use it for %[WXYZ].
* NEWS: Document this.
* tests/touch/60-seconds: Adjust test to match.
* tests/misc/stat-birthtime: Likewise.
</content>
</entry>
<entry>
<title>stat: support printing birthtime</title>
<updated>2010-10-01T16:43:25Z</updated>
<author>
<name>Eric Blake</name>
<email>eblake@redhat.com</email>
</author>
<published>2010-09-30T22:31:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=abe5c1f9bc09753fd79e7a121c8ecfa917dfaddb'/>
<id>urn:sha1:abe5c1f9bc09753fd79e7a121c8ecfa917dfaddb</id>
<content type='text'>
* src/stat.c (print_stat): New %w and %W formats.
(do_stat): Include %w in default format.
(usage): Document new specifiers.
* doc/coreutils.texi (stat invocation): Likewise.
* NEWS: Likewise.
</content>
</entry>
</feed>
