Compare commits

..

13 Commits

Author SHA1 Message Date
Eric Blake
6c935a0554 Merge remote branch 'origin/next' into next 2009-10-10 09:28:19 -06:00
Jim Meyering
3b7dc2b522 rm: record timing data
* README-rm-timing-compare: new file
* README-rm-timing-2: New file.
2009-10-10 09:21:36 -06:00
Eric Blake
aeaa6bf7ae touch: optimize use of utimens
* src/touch.c (main): Use UTIME_NOW rather than calling gettime.
(touch): Use UTIME_OMIT rather than stat.
2009-10-10 09:14:39 -06:00
Eric Blake
82e344ca09 copy: allow symlink timestamp preservation on more systems
* src/copy.c (utimens_symlink): Simplify by using lutimens.
* m4/jm-macros.m4 (coreutils_MACROS): Drop utimensat; gnulib does
this for us.
* tests/cp/preserve-slink-time: Recognize lutimes support.
2009-10-10 09:14:35 -06:00
Eric Blake
2cd1577554 build: update gnulib submodule to latest, for utimens improvements 2009-10-10 09:14:17 -06:00
Eric Blake
41c9e064a6 rm: avoid compiler warning
* src/remove.c (rm_fts): Don't allow fall-through when assertions
are disabled.
2009-09-05 16:28:46 +02:00
Eric Blake
5f303a1293 euidaccess-stat: remove unnecessary macros
* lib/euidaccess-stat.c (F_OK, R_OK, W_OK, X_OK): Delete; now
guaranteed by gnulib.
2009-09-05 16:28:46 +02:00
Eric Blake
2df272914b rm: use gnulib faccessat
* bootstrap.conf (gnulib_modules): Add faccessat.  Replace strdup
with strdup-posix.
* m4/jm-macros.m4 (coreutils_MACROS): Revert previous change, now
that gnulib does it for us.
* src/remove.c (write_protected_non_symlink): Use faccessat in
more situations.
2009-09-05 16:28:46 +02:00
Jim Meyering
278109b9f4 NEWS: mention recent improvements in rm 2009-09-05 16:28:46 +02:00
Jim Meyering
0f3f7d495c rm: improve efficiency of rm -r (without -f) from O(N^2) to O(N)
where N is the depth of the deepest hierarchy rm is processing.
* src/remove.c (write_protected_non_symlink): Use faccessat to
avoid O(N)-per-entry cost of calling euidaccess.
* m4/jm-macros.m4 (coreutils_MACROS): Check for faccessat.
2009-09-05 16:28:46 +02:00
Jim Meyering
4f87cc0364 build: placate gcc's new -Wskip-jump-init
* remove.c (rm_fts): Put braces around each of the two offending blocks.
* configure.ac: Don't turn off -Wjump-misses-init.
With the rewrite of remove.c, it is no longer needed.
2009-09-05 16:28:46 +02:00
Jim Meyering
18c5fbd5dc rm: rewrite to use fts
* remove.c: Don't include "unlinkdir.h"; no longer used.
Do not include <setjmp.h> or "cycle-check.h".  Likewise.
Include "xfts.h".
(dir_name, dir_len): Remove definitions.
(CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Likewise.
(INODE_SORT_DIR_ENTRIES_THRESHOLD, NEED_REWIND, D_TYPE): Likewise.
(struct dirstack_state, Dirstack_state): Likewise.
(g_buf, g_n_allocated): Remove declarations.
(hash_freer, hash_compare_strings, rm_malloc): Remove functions.
(rm_free, push_dir, top_dir, pop_dir, right_justify): Likewise.
(full_filename0, xfull_filename, full_filename_): Likewise.
(AD_stack_height, AD_stack_top, AD_stack_pop, AD_stack_clear): Likewise.
(obstack_init_minimal, ds_init, ds_clear, ds_free): Likewise.
(AD_pop_and_chdir, AD_ensure_initialized, AD_mark_helper): Likewise.
(AD_mark_as_unremovable, AD_mark_current_as_unremovable): Likewise.
(AD_push_initial, AD_push, AD_push, AD_is_removable): Likewise.
(write_protected_non_symlink): Change 3rd parameter from
dirstack_state "ds" to full_name.
(prompt): Adjust parameters.  Now, state comes from FTS/FTSENT pair.
Those replace fd_cwd and "ds".  Remove "filename".  Remove pdirent_type
in favor of new "is_dir" parameter.  Rename is_empty to is_empty_p.
(DO_RMDIR, DO_UNLINK): Remove definitions.
(remove_entry, fd_to_subdirp, compare_ino): Remove functions.
(dirent_count, dirent_inode_sort_may_be_useful): Likewise.
(preprocess_dir): Likewise.
(fts_skip_tree, mark_ancestor_dirs, excise, rm_fts): New functions.
(remove_cwd_entries, remove_dir, rm_1): Remove functions.
(rm): Rewrite as a simple loop calling fts_read and dispatching
each entry via rm_fts.
* src/rm.c (main): Adapt to new signature of rm().
* bootstrap.conf (gnulib_modules): Remove unlinkdir, no longer used.
* src/Makefile.am (sc_tight_scope): Also recognize an extern "enum"
declaration.
* tests/rm/empty-name: Adjust expected output to match new diagnostic.
2009-09-05 16:28:46 +02:00
Jim Meyering
cf963e5a54 rm: record timing data
* README-rm-timing-compare: new file
* README-rm-timing-2: New file.
2009-09-05 16:28:46 +02:00
680 changed files with 3816 additions and 8181 deletions

2
.gitattributes vendored
View File

@@ -5,5 +5,3 @@
# # Derived from the regexp in emacs' lisp/add-log.el.
# [diff "texinfo"]
# funcname = "^@node[ \t][ \t]*\\([^,][^,]*\\)"
gl/lib/*.diff -whitespace

14
.gitignore vendored
View File

@@ -1,10 +1,8 @@
*.I[12]
*.[EIOX]
*.bak
*.o
*/.deps
*~
._bootmp
.gdb-history
.kludge-stamp
.tarball-version
@@ -40,27 +38,21 @@ coreutils-*.tar.bz2
coreutils-*.tar.bz2.sig
coreutils-*.tar.gz
coreutils-*.tar.gz.sig
coreutils-*.tar.xz
coreutils-*.tar.xz.sig
coreutils-*.tar.lzma
coreutils-*.tar.lzma.sig
gnulib-tests
lib/.cvsignore
lib/.gitignore
lib/arg-nonnull.h
lib/arpa
lib/binary-io.h
lib/charset.alias
lib/configmake.h
lib/glthread
lib/libcoreutils.a
lib/link-warning.h
lib/printf.c
lib/progname.c
lib/progname.h
lib/selinux
lib/unistr
lib/uniwidth
lib/unused-parameter.h
lib/warn-on-use.h
m4/.cvsignore
m4/.gitignore
maint.mk
@@ -80,5 +72,3 @@ src/version.c
src/version.h
stamp-h1
tests/*/*.log
tests/t?
tests/test-suite.log

View File

@@ -1 +1 @@
8.5
8.0

View File

@@ -1,6 +1,6 @@
# Suppress valgrind diagnostics we don't care about.
# Copyright (C) 2003-2004, 2006-2010 Free Software Foundation, Inc.
# Copyright (C) 2003, 2004, 2006-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@@ -1,3 +1,2 @@
gl/lib/randint.c
lib/euidaccess-stat.c
gl/tests/test-mbsalign.c

View File

@@ -1 +0,0 @@
src/seq.c

View File

@@ -1,2 +0,0 @@
^m4/stat-prog\.m4$
ChangeLog

View File

@@ -1 +0,0 @@
^tests/pr/

View File

@@ -1,4 +0,0 @@
\.mk$
/Makefile\.am$
^tests/init\.sh$
^tests/test-lib\.sh$

View File

@@ -1,2 +0,0 @@
configure.ac
ChangeLog*

View File

@@ -4,4 +4,3 @@ Makefile\.am$
^tests/pr/
ChangeLog.*
^man/help2man$
^gl/lib/.*\.c\.diff$

View File

@@ -9,4 +9,3 @@ m4/lib-prefix.m4
m4/po.m4
aclocal.m4
src/c99-to-c89.diff
^gl/lib/.*\.c\.diff$

View File

@@ -46,12 +46,11 @@ md5sum: Ulrich Drepper, Scott Miller, David Madore
mkdir: David MacKenzie
mkfifo: David MacKenzie
mknod: David MacKenzie
mktemp: Jim Meyering, Eric Blake
mktemp: Jim Meyering
mv: Mike Parker, David MacKenzie, Jim Meyering
nice: David MacKenzie
nl: Scott Bartram, David MacKenzie
nohup: Jim Meyering
nproc: Giuseppe Scrivano
od: Jim Meyering
paste: David M. Ihnat, David MacKenzie
pathchk: Paul Eggert, David MacKenzie, Jim Meyering

View File

@@ -11609,7 +11609,7 @@
-----
Copyright (C) 2002-2005, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

View File

@@ -4033,7 +4033,7 @@
-----
Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

View File

@@ -4015,7 +4015,7 @@
-----
Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2007, 2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

View File

@@ -372,7 +372,7 @@
-----
Copyright (C) 2008-2010 Free Software Foundation, Inc.
Copyright (C) 2008-2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

109
HACKING
View File

@@ -233,107 +233,6 @@ Try to make the summary line fit one of the following forms:
maint: change-description
Curly braces: use judiciously
=============================
Omit the curly braces around an "if", "while", "for" etc. body only when
that body occupies a single line. In every other case we require the braces.
This ensures that it is trivially easy to identify a single-*statement* loop:
each has only one *line* in its body.
Omitting braces with a single-line body is fine:
while (expr)
single_line_stmt ();
However, the moment your loop/if/else body extends onto a second line,
for whatever reason (even if it's just an added comment), then you should
add braces. Otherwise, it would be too easy to insert a statement just
before that comment (without adding braces), thinking it is already a
multi-statement loop:
while (true)
/* comment... */ // BAD: multi-line body without braces
single_line_stmt ();
Do this instead:
while (true)
{ /* Always put braces around a multi-line body. */
/* explanation... */
single_line_stmt ();
}
There is one exception: when the second body line is not at the same
indentation level as the first body line.
if (expr)
error (0, 0, _("a diagnostic that would make this line"
" extend past the 80-column limit"));
It is safe to omit the braces in the code above, since the
further-indented second body line makes it obvious that this is still
a single-statement body.
To reiterate, don't do this:
if (expr)
while (expr_2) // BAD: multi-line body without braces
{
...
}
Do this, instead:
if (expr)
{
while (expr_2)
{
...
}
}
However, there is one exception in the other direction, when even a
one-line block should have braces. That occurs when that one-line,
brace-less block is an "else" block, and the corresponding "then" block
*does* use braces. In that case, either put braces around the "else"
block, or negate the "if"-condition and swap the bodies, putting the
one-line block first and making the longer, multi-line block be the
"else" block.
if (expr)
{
...
...
}
else
x = y; // BAD: braceless "else" with braced "then"
This is preferred, especially when the multi-line body is more than a
few lines long, because it is easier to read and grasp the semantics of
an if-then-else block when the simpler block occurs first, rather than
after the more involved block:
if (!expr)
x = y; /* more readable */
else
{
...
...
}
If you'd rather not negate the condition, then add braces:
if (expr)
{
...
...
}
else
{
x = y;
}
Use SPACE-only indentation in all[*] files
==========================================
We use space-only indentation in nearly all files.
@@ -411,9 +310,9 @@ Nearly every significant change must be accompanied by a test suite
addition that exercises it. If you fix a bug, add at least one test that
fails without the patch, but that succeeds once your patch is applied.
If you add a feature, add tests to exercise as much of the new code
as possible. Note to run tests/misc/new-test in isolation you can do:
as possible. Note to run tests/misc/newtest in isolation you can do:
(cd tests && make check TESTS=misc/new-test VERBOSE=yes)
(cd tests && make check TESTS=misc/newtest VERBOSE=yes)
There are hundreds of tests in the tests/ directories. You can use
tests/sample-test as a template, or one of the various Perl-based ones
@@ -582,10 +481,10 @@ Then just open the index.html file (in the generated lcov-html directory)
in your favorite web browser.
========================================================================
Copyright (C) 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2009 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the ``GNU Free

View File

@@ -1,6 +1,6 @@
# Make coreutils. -*-Makefile-*-
# Copyright (C) 1990, 1993-2010 Free Software Foundation, Inc.
# Copyright (C) 1990, 1993-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -46,11 +46,7 @@ syntax_check_exceptions = \
.x-sc_obsolete_symbols \
.x-sc_po_check \
.x-sc_program_name \
.x-sc_prohibit_always-defined_macros \
.x-sc_prohibit_atoi_atof \
.x-sc_prohibit_empty_lines_at_EOF \
.x-sc_prohibit_fail_0 \
.x-sc_prohibit_magic_number_exit \
.x-sc_prohibit_stat_st_blocks \
.x-sc_prohibit_strcmp \
.x-sc_prohibit_tab_based_indentation \
@@ -60,7 +56,6 @@ syntax_check_exceptions = \
.x-sc_sun_os_names \
.x-sc_system_h_headers \
.x-sc_trailing_blank \
.x-sc_prohibit_always_true_header_tests \
.x-sc_unmarked_diagnostics \
.x-sc_useless_cpp_parens

261
NEWS
View File

@@ -2,278 +2,21 @@ GNU coreutils NEWS -*- outline -*-
* Noteworthy changes in release ?.? (????-??-??) [?]
** New features
du recognizes -d N as equivalent to --max-depth=N, for compatibility
with FreeBSD.
sort now accepts the --debug option, to highlight the part of the
line significant in the sort, and warn about questionable options.
** Changes in behavior
sort -g now uses long doubles for greater range and precision.
touch's --file option is no longer recognized. Use --reference=F (-r)
instead. --file has not been documented for 15 years, and its use has
elicited a warning since coreutils-7.1.
truncate now supports setting file sizes relative to a reference file.
Also errors are no longer suppressed for unsupported file types, and
relative sizes are restricted to supported file types.
* Noteworthy changes in release 8.5 (2010-04-23) [stable]
** Bug fixes
cp and mv once again support preserving extended attributes.
[bug introduced in coreutils-8.4]
cp now preserves "capabilities" when also preserving file ownership.
ls --color once again honors the 'NORMAL' dircolors directive.
[bug introduced in coreutils-6.11]
sort -M now handles abbreviated months that are aligned using blanks
in the locale database. Also locales with 8 bit characters are
handled correctly, including multi byte locales with the caveat
that multi byte characters are matched case sensitively.
sort again handles obsolescent key formats (+POS -POS) correctly.
Previously if -POS was specified, 1 field too many was used in the sort.
[bug introduced in coreutils-7.2]
** New features
join now accepts the --header option, to treat the first line of each
file as a header line to be joined and printed unconditionally.
timeout now accepts the --kill-after option which sends a kill
signal to the monitored command if it's still running the specified
duration after the initial signal was sent.
who: the "+/-" --mesg (-T) indicator of whether a user/tty is accepting
messages could be incorrectly listed as "+", when in fact, the user was
not accepting messages (mesg no). Before, who would examine only the
permission bits, and not consider the group of the TTY device file.
Thus, if a login tty's group would change somehow e.g., to "root",
that would make it unwritable (via write(1)) by normal users, in spite
of whatever the permission bits might imply. Now, when configured
using the --with-tty-group[=NAME] option, who also compares the group
of the TTY device with NAME (or "tty" if no group name is specified).
** Changes in behavior
ls --color no longer emits the final 3-byte color-resetting escape
sequence when it would be a no-op.
join -t '' no longer emits an error and instead operates on
each line as a whole (even if they contain NUL characters).
* Noteworthy changes in release 8.4 (2010-01-13) [stable]
** Bug fixes
nproc --all is now guaranteed to be as large as the count
of available processors, which may not have been the case
on GNU/Linux systems with neither /proc nor /sys available.
[bug introduced in coreutils-8.1]
** Build-related
Work around a build failure when using buggy <sys/capability.h>.
Alternatively, configure with --disable-libcap.
Compilation would fail on systems using glibc-2.7..2.9 due to changes in
gnulib's wchar.h that tickled a bug in at least those versions of glibc's
own <wchar.h> header. Now, gnulib works around the bug in those older
glibc <wchar.h> headers.
Building would fail with a link error (cp/copy.o) when XATTR headers
were installed without the corresponding library. Now, configure
detects that and disables xattr support, as one would expect.
* Noteworthy changes in release 8.3 (2010-01-07) [stable]
** Bug fixes
cp -p, install -p, mv, and touch -c could trigger a spurious error
message when using new glibc coupled with an old kernel.
[bug introduced in coreutils-6.12].
ls -l --color no longer prints "argetm" in front of dangling
symlinks when the 'LINK target' directive was given to dircolors.
[bug introduced in fileutils-4.0]
pr's page header was improperly formatted for long file names.
[bug introduced in coreutils-7.2]
rm -r --one-file-system works once again.
The rewrite to make rm use fts introduced a regression whereby
a commmand of the above form would fail for all subdirectories.
[bug introduced in coreutils-8.0]
stat -f recognizes more file system types: k-afs, fuseblk, gfs/gfs2, ocfs2,
and rpc_pipefs. Also Minix V3 is displayed correctly as minix3, not minux3.
[bug introduced in coreutils-8.1]
tail -f (inotify-enabled) once again works with remote files.
The use of inotify with remote files meant that any changes to those
files that was not done from the local system would go unnoticed.
[bug introduced in coreutils-7.5]
tail -F (inotify-enabled) would abort when a tailed file is repeatedly
renamed-aside and then recreated.
[bug introduced in coreutils-7.5]
tail -F (inotify-enabled) could fail to follow renamed files.
E.g., given a "tail -F a b" process, running "mv a b" would
make tail stop tracking additions to "b".
[bug introduced in coreutils-7.5]
touch -a and touch -m could trigger bugs in some file systems, such
as xfs or ntfs-3g, and fail to update timestamps.
[bug introduced in coreutils-8.1]
wc now prints counts atomically so that concurrent
processes will not intersperse their output.
[the issue dates back to the initial implementation]
* Noteworthy changes in release 8.2 (2009-12-11) [stable]
** Bug fixes
id's use of mgetgroups no longer writes beyond the end of a malloc'd buffer
[bug introduced in coreutils-8.1]
id no longer crashes on systems without supplementary group support.
[bug introduced in coreutils-8.1]
rm once again handles zero-length arguments properly.
The rewrite to make rm use fts introduced a regression whereby
a command like "rm a '' b" would fail to remove "a" and "b", due to
the presence of the empty string argument.
[bug introduced in coreutils-8.0]
sort is now immune to the signal handling of its parent.
Specifically sort now doesn't exit with an error message
if it uses helper processes for compression and its parent
ignores CHLD signals. [bug introduced in coreutils-6.9]
tail without -f no longer access uninitialized memory
[bug introduced in coreutils-7.6]
timeout is now immune to the signal handling of its parent.
Specifically timeout now doesn't exit with an error message
if its parent ignores CHLD signals. [bug introduced in coreutils-7.6]
a user running "make distcheck" in the coreutils source directory,
with TMPDIR unset or set to the name of a world-writable directory,
and with a malicious user on the same system
was vulnerable to arbitrary code execution
[bug introduced in coreutils-5.0]
* Noteworthy changes in release 8.1 (2009-11-18) [stable]
** Bug fixes
chcon no longer exits immediately just because SELinux is disabled.
Even then, chcon may still be useful.
[bug introduced in coreutils-8.0]
chcon, chgrp, chmod, chown and du now diagnose an ostensible directory cycle
and arrange to exit nonzero. Before, they would silently ignore the
offending directory and all "contents."
env -u A=B now fails, rather than silently adding A to the
environment. Likewise, printenv A=B silently ignores the invalid
name. [the bugs date back to the initial implementation]
ls --color now handles files with capabilities correctly. Previously
files with capabilities were often not colored, and also sometimes, files
without capabilites were colored in error. [bug introduced in coreutils-7.0]
md5sum now prints checksums atomically so that concurrent
processes will not intersperse their output.
This also affected sum, sha1sum, sha224sum, sha384sum and sha512sum.
[the bug dates back to the initial implementation]
mktemp no longer leaves a temporary file behind if it was unable to
output the name of the file to stdout.
[the bug dates back to the initial implementation]
nice -n -1 PROGRAM now runs PROGRAM even when its internal setpriority
call fails with errno == EACCES.
[the bug dates back to the initial implementation]
nice, nohup, and su now refuse to execute the subsidiary program if
they detect write failure in printing an otherwise non-fatal warning
message to stderr.
stat -f recognizes more file system types: afs, cifs, anon-inode FS,
btrfs, cgroupfs, cramfs-wend, debugfs, futexfs, hfs, inotifyfs, minux3,
nilfs, securityfs, selinux, xenfs
tail -f (inotify-enabled) now avoids a race condition.
Before, any data appended in the tiny interval between the initial
read-to-EOF and the inotify watch initialization would be ignored
initially (until more data was appended), or forever, if the file
were first renamed or unlinked or never modified.
[The race was introduced in coreutils-7.5]
tail -F (inotify-enabled) now consistently tails a file that has been
replaced via renaming. That operation provokes either of two sequences
of inotify events. The less common sequence is now handled as well.
[The bug came with the implementation change in coreutils-7.5]
timeout now doesn't exit unless the command it is monitoring does,
for any specified signal. [bug introduced in coreutils-7.0].
** Changes in behavior
chroot, env, nice, and su fail with status 125, rather than 1, on
internal error such as failure to parse command line arguments; this
is for consistency with stdbuf and timeout, and avoids ambiguity
with the invoked command failing with status 1. Likewise, nohup
fails with status 125 instead of 127.
du (due to a change in gnulib's fts) can now traverse NFSv4 automounted
directories in which the stat'd device number of the mount point differs
during a traversal. Before, it would fail, because such a mismatch would
usually represent a serious error or a subversion attempt.
echo and printf now interpret \e as the Escape character (0x1B).
rm -f /read-only-fs/nonexistent now succeeds and prints no diagnostic
on systems with an unlinkat syscall that sets errno to EROFS in that case.
Before, it would fail with a "Read-only file system" diagnostic.
Also, "rm /read-only-fs/nonexistent" now reports "file not found" rather
than the less precise "Read-only file system" error.
** New programs
nproc: Print the number of processing units available to a process.
** New features
env and printenv now accept the option --null (-0), as a means to
avoid ambiguity with newlines embedded in the environment.
md5sum --check now also accepts openssl-style checksums.
So do sha1sum, sha224sum, sha384sum and sha512sum.
mktemp now accepts the option --suffix to provide a known suffix
after the substitution in the template. Additionally, uses such as
"mktemp fileXXXXXX.txt" are able to infer an appropriate --suffix.
touch now accepts the option --no-dereference (-h), as a means to
change symlink timestamps on platforms with enough support.
* Noteworthy changes in release 8.0 (2009-10-06) [beta]
@@ -2978,10 +2721,10 @@ packages, see ./old/*/NEWS.
========================================================================
Copyright (C) 2001-2010 Free Software Foundation, Inc.
Copyright (C) 2001-2009 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the ``GNU Free

6
README
View File

@@ -11,7 +11,7 @@ The programs that can be built with this package are:
csplit cut date dd df dir dircolors dirname du echo env expand expr
factor false fmt fold groups head hostid hostname id install join kill
link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup
nproc od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir
od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir
runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred shuf
sleep sort split stat stdbuf stty su sum sync tac tail tee test timeout
touch tr true truncate tsort tty uname unexpand uniq unlink uptime users
@@ -229,10 +229,10 @@ the address on the last line of --help output.
========================================================================
Copyright (C) 1998, 2002-2010 Free Software Foundation, Inc.
Copyright (C) 1998, 2002-2009 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the ``GNU Free

View File

@@ -28,12 +28,6 @@ You can get a copy of the source repository like this:
$ git clone git://git.sv.gnu.org/coreutils
$ cd coreutils
As an optional step, if you already have a copy of the gnulib git
repository on your hard drive, then you can use it as a reference to
reduce download time and disk space requirements:
$ export GNULIB_SRCDIR=/path/to/gnulib
The next step is to get and check other files needed to build,
which are extracted from other source packages:
@@ -41,7 +35,7 @@ which are extracted from other source packages:
And there you are! Just
$ ./configure --quiet #[--enable-gcc-warnings] [*]
$ ./configure #[--enable-gcc-warnings]
$ make
$ make check
@@ -54,15 +48,9 @@ should output no difference.
Enjoy!
[*] The --enable-gcc-warnings option is useful only with glibc
and with a very recent version of gcc. You'll probably also have
to use recent system headers. If you configure with this option,
and spot a problem, please be sure to send the report to the bug
reporting address of this package, and not to that of gnulib, even
if the problem seems to originate in a gnulib-provided file.
-----
Copyright (C) 2002-2010 Free Software Foundation, Inc.
Copyright (C) 2002-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -10,12 +10,9 @@ coreutils package, see these:
http://mail.gnu.org/mailman/listinfo/coreutils-announce
http://mail.gnu.org/mailman/listinfo/bug-coreutils
http://mail.gnu.org/mailman/listinfo/coreutils
mailing list archives are here:
http://news.gmane.org/gmane.comp.gnu.coreutils.announce
http://news.gmane.org/gmane.comp.gnu.core-utils.bugs (up to the minute)
http://mail.gnu.org/pipermail/bug-coreutils/ (updated every 12 hours)
http://news.gmane.org/gmane.comp.gnu.coreutils.general
http://mail.gnu.org/pipermail/coreutils/ (updated every 12 hours)

View File

@@ -14,26 +14,18 @@ I.E. the tools checked for by the bootstrap script and include:
- Texinfo <http://www.gnu.org/software/texinfo/>
Note please try to install/build official packages for your system.
If these programs are not available use the following instructions
to build them and install the results into a directory that you will
then use when building this package.
Even if the official version of a package for your system is too old,
please install it, as it may be required to build the newer versions.
The examples below install into $HOME/coreutils/deps/, so if you are
going to follow these instructions, first ensure that your $PATH is
set correctly by running this command:
prefix=$HOME/coreutils/deps
export PATH=$prefix/bin:$PATH
If these are not available then one can make them available only to
the coreutils build using the following instructions. Even if the
official packages for your system are too old, please install them
as they may be required to build the newer versions.
* autoconf *
# Note Autoconf 2.62 or newer is needed to build automake-1.11.1
# Note Autoconf 2.62 or newer is needed to build automake-1.11
git clone --depth=1 git://git.sv.gnu.org/autoconf.git
git checkout v2.62
autoreconf -vi
./configure --prefix=$prefix
./configure --prefix=$HOME/coreutils/deps
make install
* automake *
@@ -41,12 +33,12 @@ set correctly by running this command:
# Note help2man is required to build automake fully
git clone git://git.sv.gnu.org/automake.git
cd automake
git checkout v1.11.1
git checkout -b branch-1.11 --track origin/branch-1.11
./bootstrap
./configure --prefix=$prefix
./configure --prefix=$HOME/coreutils/deps
make install
This package uses XZ utils (successor to LZMA) to create
coreutils uses XZ utils (successor to LZMA) to create
a compressed distribution tarball. Using this feature of Automake
requires version 1.10a or newer, as well as the xz program itself.
@@ -55,7 +47,10 @@ requires version 1.10a or newer, as well as the xz program itself.
git clone git://ctrl.tukaani.org/xz.git
cd xz
./autogen.sh
./configure --prefix=$prefix
./configure --prefix=$HOME/coreutils/deps
make install
Now you can build this package as described in README-hacking.
Now we can build coreutils as described in README-hacking
as long as $PATH starts with $HOME/coreutils/deps/bin, which
one can set for the current shell like:
$ export PATH=$HOME/coreutils/deps/bin:$PATH

View File

@@ -13,34 +13,29 @@ Here are most of the steps we (maintainers) follow when making a release.
* Ensure that you're on "master" with no uncommitted diffs.
This should produce no output: git checkout master; git diff
* Run bootstrap one last time. This downloads any new translations:
./bootstrap
* Run bootstrap: ./bootstrap
FIXME: enable excluded programs like arch? to get their manual pages?
* Pre-release testing:
Ensure that make check syntax-check succeeds.
On at least one SELinux-enabled (enforcing) and one non-SELinux system,
run all tests, both root-only and regular.
Run *all* non-root tests, including expensive and very expensive ones i.e.,
run this: make -j1 check RUN_VERY_EXPENSIVE_TESTS=yes RUN_EXPENSIVE_TESTS=yes
Run the following on at least one SELinux-enabled (enforcing) and
one non-SELinux system:
Run the root-only tests:
sudo env PATH="$PATH" NON_ROOT_USERNAME=$USER make -k check-root
make distcheck
make -j1 check RUN_VERY_EXPENSIVE_TESTS=yes RUN_EXPENSIVE_TESTS=yes
sudo env PATH="$PATH" NON_ROOT_USERNAME=$USER make -k check-root
* Run "make distcheck"
Note the -j1 above. If you use -jN, for larger N, some of the expensive
tests are likely to interfere with concurrent performance-measuring or
timing-sensitive tests, resulting in spurious failures.
* Manually set the date, version number, and [stable/alpha/beta] on
line 3 of NEWS, then do e.g.,:
If "make distcheck" doesn't run "make syntax-check" for you, then run
it manually:
make syntax-check
* Set the date, version number, and release type [stable/alpha/beta] on
line 3 of NEWS, commit that, and tag the release by running e.g.,
build-aux/do-release-commit-and-tag X.Y stable
v=8.0
pkg=$(sed -n 's/^PACKAGE = \(.*\)/\1/p' Makefile)
git commit -F <(printf 'version '$v'\n\n* NEWS: Record release date.\n') -a
git tag -s -m "$pkg $v" v$v HEAD
* Run the following to create release tarballs. Your choice selects the
corresponding upload-to destination in the emitted gnupload command.
@@ -54,45 +49,45 @@ FIXME: enable excluded programs like arch? to get their manual pages?
it builds and passes all tests.
* While that's happening, write the release announcement that you will
soon post. Start with the template, $HOME/announce-coreutils-X.Y
that was just created by that "make" command.
soon post.
Once all the builds and tests have passed,
* Run the gnupload command that was suggested by your "make stable" run above.
* Run the gnupload command that was suggested by your "make major" run above.
* Wait a few minutes (maybe up to 30?) and then use the release URLs to
download all tarball/signature pairs and use gpg --verify to ensure
that they're all valid.
* Push the NEWS-updating changes and the new tag:
* Push the new tag:
v=$(cat .prev-version)
git push origin master tag v$v
git push origin tag v$v
* Announce it on Savannah first, so you can include the preferable
savannah.org announcement link in the email message.
* Send the gpg-signed announcement mail, e.g.,
To: info-gnu@gnu.org, coreutils-announce@gnu.org
Cc: coordinator@translationproject.org, bug-coreutils@gnu.org
Subject: coreutils-8.0 released [beta]
* Approve the announcement here:
http://lists.gnu.org/mailman/admindb/coreutils-announce
* Announce it on Savannah, too:
From here:
https://savannah.gnu.org/projects/coreutils/
click on the "submit news", then write something like the following:
(If there is no such button, then enable "News" for the project via
the Main -> "Select Features" menu item, or via this link:
https://savannah.gnu.org/project/admin/editgroupfeatures.php?group=coreutils)
https://savannah.gnu.org/project/admin/editgroupfeatures.php?group=gzip)
Subject: coreutils-X.Y released [stable]
+verbatim+
...paste the announcement here...
-verbatim-
Subject: coreutils-0.0 released [beta]
The announcement is here:
http://article.gmane.org/gmane.comp.gnu.core-utils.announce/54
Then go here to approve it:
https://savannah.gnu.org/news/approve.php?group=coreutils
* Send the announcement email message.
* Approve the announcement here:
http://lists.gnu.org/mailman/admindb/coreutils-announce
* After each non-alpha release, update the on-line manual accessible via
http://www.gnu.org/software/coreutils/manual/

View File

@@ -1,7 +1,7 @@
#! /bin/bash
# Convert this package for use with valgrind.
# Copyright (C) 2002-2006, 2009-2010 Free Software Foundation, Inc.
# Copyright (C) 2002-2006, 2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

27
THANKS
View File

@@ -12,12 +12,10 @@ Aaron Hawley ashawley@uvm.edu
Achim Blumensath blume@corona.oche.de
Adam Jimerson vendion@charter.net
Adam Klein aklein@debian.org
Adam Sampson ats@offog.org
Adrian Bunk bunk@stusta.de
AIDA Shinra shinra@j10n.org
Akim Demaille demaille@inf.enst.fr
Alain Magloire alain@qnx.com
Alan Curry pacman@kosh.dhis.org
Alan Iwi iwi@atm.ox.ac.uk
Albert Chin-A-Young china@thewrittenword.com
Albert Hopkins ahopkins@dynacare.com
@@ -54,7 +52,6 @@ Andy Longton alongton@metamark.com
Anthony Thyssen anthony@griffith.edu.au
Antonio Rendas ajrendas@yahoo.com
Ariel Faigon ariel@cthulhu.engr.sgi.com
Arjan Opmeer arjan.opmeer@gmail.com
Arne H. Juul arnej@solan.unit.no
Arne Henrik Juul arnej@imf.unit.no
Arnold Robbins arnold@skeeve.com
@@ -104,10 +101,8 @@ Carlos Canau Carlos.Canau@relay.puug.pt
Charles Karney karney@pppl.gov
Charles Randall crandall@matchlogic.com
Chip Salzenberg chip@valinux.com
Chris Clayton chris2553@googlemail.com
Chris Faylor cgf@cygnus.com
Chris J. Bednar cjb@AdvancedDataSolutions.com
Chris Jones cjns1989@gmail.com
Chris Lesniewski ctl@mit.edu
Chris Sylvain csylvain@umm.edu
Chris Yeo cyeo@biking.org
@@ -154,7 +149,6 @@ Dawson Engler engler@stanford.edu
Dean Gaudet dean-savannah@arctic.org
Deepak Goel deego@gnufans.org
Denis Excoffier denis.excoffier@airbus.com
Denis McKeon dmckeon@swcp.com
Dennis Henriksen opus@flamingo.osrl.dk
Dennis Smit ds@nerds-incorporated.org
Derek Clegg dclegg@next.com
@@ -179,7 +173,6 @@ Elbert Pol elbert.pol@gmail.com
Eli Zaretskii eliz@is.elta.co.il
Elias Pipping pipping@gentoo.org
Emile LeBlanc leblanc@math.toronto.edu
Emmanuel Lacour elacour@home-dn.net
Erik Auerswald auerswal@unix-ag.uni-kl.de
Eric Backus ericb@lsid.hp.com
Eric Blake ebb9@byu.net
@@ -192,7 +185,6 @@ Evan Hunt ethanol@armory.com
Felix Lee flee@teleport.com
Felix Rauch Valenti frauch@cse.unsw.edu.au
Ferdinand fw@scenic.mine.nu
Filipus Klutiero chealer@gmail.com
Fletcher Mattox fletcher@cs.utexas.edu
Florent Bayle florent@sarcelle.net
Florian Schlichting fschlich@cis.fu-berlin.de
@@ -218,7 +210,6 @@ Geoff Whale geoffw@cse.unsw.EDU.AU
Gerald Pfeifer gerald@pfeifer.com
Gerhard Poul gpoul@gnu.org
Germano Leichsenring germano@jedi.cs.kobe-u.ac.jp
Gilles Espinasse g.esp@free.fr
Glen Lenker glen.lenker@gmail.com
Göran Uddeborg goeran@uddeborg.se
Guochun Shi gshi@ncsa.uiuc.edu
@@ -255,9 +246,7 @@ Ian Turner vectro@pipeline.com
Iida Yosiaki iida@gnu.org
Ilya N. Golubev gin@mo.msk.ru
Ingo Saitz ingo@debian.org
Ivan Labath labath3@st.fmph.uniba.sk
Ivo Timmermans ivo@debian.org
Jacky Fong jacky.fong@utoronto.ca
James james@albion.glarp.com
James Antill jmanti%essex.ac.uk@seralph21.essex.ac.uk
James Lemley James.Lemley@acxiom.com
@@ -273,7 +262,6 @@ Jan Engelhardt jengelh@medozas.de
Jan Fedak J.Fedak@sh.cvut.cz
Jan Moringen jan.moringen@uni-bielefeld.de
Jan Nieuwenhuizen janneke@gnu.org
Jan-Pawel Wrozstinski jpwroz@gmail.com
Janos Farkas chexum@shadow.banki.hu
Jarkko Hietaniemi jhi@epsilon.hut.fi
Jarod Wilson jwilson@redhat.com
@@ -308,7 +296,6 @@ John Kodis kodis@acm.org
John Murphy jam@philabs.research.philips.com
John Roll john@panic.harvard.edu
John Salmon johns@mullet.anu.edu.au
John Stanley johnstops@verizon.net
John Summerfield summer@OS2.ami.com.au
Jon Peatfield J.S.Peatfield@damtp.cam.ac.uk
Joost van Baal joostvb@xs4all.nl
@@ -339,12 +326,10 @@ Keith Owens kaos@audio.apana.org.au
Keith Thompson kst@cts.com
Ken Pizzini kenp@halcyon.com
Kevin Mudrick kmudrick@healthmarketscience.com
Kim Hansen kim@i9.dk
Kirk Kelsey kirk.kelsey@0x4b.net
Kristin E Thomas kristint@us.ibm.com
Kjetil Torgrim Homme kjetilho@ifi.uio.no
Kristoffer Rose kris@diku.dk
Ladislav Hagara ladislav.hagara@unob.cz
Larry McVoy lm@sgi.com
Lars Hecking lhecking@nmrc.ucc.ie
Leah Q eequor@earthlink.net
@@ -383,7 +368,6 @@ Martin martin@dresden.nacamar.de
Martin Buck martin.buck@ascom.ch
Martin Gallant martyg@goodbit.net
Martin Hippe martin.hippe@schlund.de
Martin Jacobs martin.jacobs@arcor.de
Martin Michlmayr tbm@cyrius.com
Martin Mitchell martin@debian.org
Martin P.J. Zinser zinser@decus.de
@@ -413,7 +397,7 @@ Max Chang maxchang@ucla.edu
Meelis Roos mroos@tartu.cyber.ee
Michael michael@aplatform.com
Michael ??? michael@roka.net
Michael Bacarella mbac@netgraft.com
Michael Bacarella mbac@netgraft.com>
Michael Deutschmann michael@talamasca.ocis.net
Michael Elizabeth Chastain mec.gnu@mindspring.com
Michael Gaughen mgaughen@polyserve.com
@@ -500,7 +484,6 @@ Philippe Schnoebelen Philippe.Schnoebelen@imag.fr
Phillip Jones mouse@datastacks.com
Piergiorgio Sartor sartor@sony.de
Pieter Bowman bowman@math.utah.edu
Piotr Gackiewicz gacek@intertele.pl
Piotr Kwapulinski kwap@univ.gda.pl
Prashant TR tr@eth.net
Priit Jõerüüt jemm4jemm@yahoo.com
@@ -521,12 +504,9 @@ Richard Sharman rsharman@magmacom.com
Rick Sladkey jrs@world.std.com
Rik Faith faith@cs.unc.edu
Risto Kankkunen kankkune@lingsoft.fi
Rob Wortman wyrm@haell.com
Robert H. de Vries robert@and.nl
Robert Lindgren robert@orcafat.com
Robert Millan zeratul2@wanadoo.es
Robert Schwebel r.schwebel@pengutronix.de
Robin H. Johnson robbat2@gentoo.org
Rogier Wolff R.E.Wolff@BitWizard.nl
Roland Huebner ro-huebner@gmx.de
Roland Turner raz.tah.bet@raz.cx
@@ -543,7 +523,6 @@ Samuli Karkkainen Samuli.Karkkainen@hut.fi
Sander van Malssen svm@kozmix.ow.nl
Santiago Vila Doncel sanvila@unex.es
Savochkin Andrey Vladimirovich saw@msu.ru
Scott Harrison scott.gnu.2009@scottrix.co.uk
Scott Lurndal slurn@griffin.engr.sgi.com
Sébastien Maret smaret@umich.edu
Sergei Steshenko sergstesh@yahoo.com
@@ -553,7 +532,6 @@ Solar Designer solar@owl.openwall.com
Stanislav Ievlev inger@altlinux.ru
Stavros Passas stabat@ics.forth.gr
Stéphane Chazelas Stephane_CHAZELAS@yahoo.fr
Stéphane Raimbault stephane.raimbault@makina-corpus.com
Stephen Depooter sbdep@myrealbox.com
Stephen Eglen eglen@pcg.wustl.edu
Stephen Gildea gildea@stop.mail-abuse.org
@@ -561,13 +539,11 @@ Stephen Smoogen smooge@mindspring.com
Steve McConnel steve@acadcomp.sil.org
Steve McIntyre steve@einval.com
Steve Ward planet36@gmail.com
Steven Drake sbd@users.sourceforge.net
Steven G. Johnson stevenj@alum.mit.edu
Steven Mocking ufo@quicknet.nl
Steven Parkes smparkes@smparkes.net
Steven Schveighoffer schveiguy@yahoo.com
Steven P Watson steven@magelico.net
Stuart Citrin ctrn3e8@gmail.com
Stuart Kemp skemp@peter.bmc.com
Stuart Shelton stuart@shelton.me
Sven Joachim svenjoac@gmx.de
@@ -638,7 +614,6 @@ Wolfram Kleff kleff@cs.uni-bonn.de
Won-kyu Park wkpark@chem.skku.ac.kr
Yanko Kaneti yaneti@declera.com
Yann Dirson dirson@debian.org
Yutaka Amanai yasai-itame1942@jade.plala.or.jp
Zvi Har'El rl@math.technion.ac.il
;; Local Variables:

10
TODO
View File

@@ -12,6 +12,7 @@ Modify chmod so that it does not change an inode's st_ctime
Discussed more recently on <http://bugs.debian.org/497514>.
document the following in coreutils.texi:
mktemp
[
pinky
@@ -34,9 +35,6 @@ printf:
platforms where the native *printf(3) is deficient.
Suggestion from Eric Blake.
consider adding some implementation of the "col" utility
Suggested by Karl Berry.
renice: POSIX utility, needs implementing.
suggestion from Karl Berry (among others).
Bob Proulx is working on this.
@@ -62,6 +60,10 @@ Integrate use of sendfile, suggested here:
http://mail.gnu.org/archive/html/bug-fileutils/2003-03/msg00030.html
I don't plan to do that, since a few tests demonstrate no significant benefit.
Should printf '\0123' print "\n3"?
per report from TAKAI Kousuke on Mar 27
http://mail.gnu.org/archive/html/bug-coreutils/2003-03/index.html
printf: consider adapting builtins/printf.def from bash
tail: don't use xlseek; it *exits*.
@@ -168,7 +170,7 @@ pr's use of nstrftime can make it malloc a very large (up to SIZE_MAX) buffer
-----
Copyright (C) 2002-2010 Free Software Foundation, Inc.
Copyright (C) 2002-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,10 +1,8 @@
#! /bin/sh
# Print a version string.
scriptversion=2010-04-30.16; # UTC
# Bootstrap this package from checked-out sources.
# Copyright (C) 2003-2010 Free Software Foundation, Inc.
# Copyright (C) 2003-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,15 +17,7 @@ scriptversion=2010-04-30.16; # UTC
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Originally written by Paul Eggert. The canonical version of this
# script is maintained as build-aux/bootstrap in gnulib, however, to
# be useful to your project, you should place a copy of it under
# version control in the top-level directory of your project. The
# intent is that all customization can be done with a bootstrap.conf
# file also maintained in your version control; gnulib comes with a
# template build-aux/bootstrap.conf to get you started.
# Please report bugs or propose patches to bug-gnulib@gnu.org.
# Written by Paul Eggert.
nl='
'
@@ -53,7 +43,7 @@ Options:
sources reside. Use this if you already
have gnulib sources on your machine, and
do not want to waste your bandwidth downloading
them again. Defaults to \$GNULIB_SRCDIR.
them again.
--copy Copy files instead of creating symbolic links.
--force Attempt to bootstrap even if the sources seem
not to have been checked out.
@@ -81,7 +71,6 @@ gnulib_modules=
gnulib_files=
# A function to be called after everything else in this script.
# Override it via your own definition in bootstrap.conf.
bootstrap_epilogue() { :; }
# The command to download all .po files for a specified domain into
@@ -143,8 +132,7 @@ XGETTEXT_OPTIONS='\\\
--flag=error:3:c-format --flag=error_at_line:5:c-format\\\
'
# Package bug report address and copyright holder for gettext files
COPYRIGHT_HOLDER='Free Software Foundation, Inc.'
# Package bug report address for gettext files
MSGID_BUGS_ADDRESS=bug-$package@gnu.org
# Files we don't want to import.
@@ -171,6 +159,7 @@ vc_ignore=auto
# die otherwise.
find_tool ()
{
# Find sha1sum, named gsha1sum on MacPorts.
find_tool_envvar=$1
shift
find_tool_names=$@
@@ -198,8 +187,8 @@ find_tool ()
eval "export $find_tool_envvar"
}
# Find sha1sum, named gsha1sum on MacPorts, and shasum on MacOS 10.6.
find_tool SHA1SUM sha1sum gsha1sum shasum
# Find sha1sum, named gsha1sum on MacPorts.
find_tool SHA1SUM sha1sum gsha1sum
# Override the default configuration, if necessary.
# Make sure that bootstrap.conf is sourced from the current directory
@@ -324,20 +313,10 @@ get_version() {
$app --version >/dev/null 2>&1 || return 1
$app --version 2>&1 |
sed -n '# extract version within line
s/.*[v ]\{1,\}\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
sed -n 's/[^0-9.]*\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/p
t done
# extract version at start of line
s/^\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
t done
d
:done
#the following essentially does s/5.005/5.5/
s/\.0*\([1-9]\)/.\1/g
p
q'
}
@@ -400,7 +379,7 @@ fi
cleanup_gnulib() {
status=$?
rm -fr "$gnulib_path"
rm -fr gnulib
exit $status
}
@@ -408,8 +387,6 @@ git_modules_config () {
test -f .gitmodules && git config --file .gitmodules "$@"
}
gnulib_path=`git_modules_config submodule.gnulib.path`
# Get gnulib files.
case ${GNULIB_SRCDIR--} in
@@ -419,43 +396,30 @@ case ${GNULIB_SRCDIR--} in
git submodule init || exit $?
git submodule update || exit $?
elif [ ! -d "$gnulib_path" ]; then
elif [ ! -d gnulib ]; then
echo "$0: getting gnulib files..."
trap cleanup_gnulib 1 2 13 15
git clone -h|grep -- --depth > /dev/null && shallow='--depth 2' || shallow=
git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
git clone --help|grep depth > /dev/null && shallow='--depth 2' || shallow=
git clone $shallow git://git.sv.gnu.org/gnulib ||
cleanup_gnulib
trap - 1 2 13 15
fi
GNULIB_SRCDIR=$gnulib_path
GNULIB_SRCDIR=gnulib
;;
*)
# Use GNULIB_SRCDIR as a reference.
# Redirect the gnulib submodule to the directory on the command line
# if possible.
if test -d "$GNULIB_SRCDIR"/.git && \
git_modules_config submodule.gnulib.url >/dev/null; then
git submodule init
GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
echo "$0: getting gnulib files..."
if git submodule -h|grep -- --reference > /dev/null; then
# Prefer the one-liner available in git 1.6.4 or newer.
git submodule update --init --reference "$GNULIB_SRCDIR" \
"$gnulib_path" || exit $?
else
# This fallback allows at least git 1.5.5.
if test -f "$gnulib_path"/gnulib-tool; then
# Since file already exists, assume submodule init already complete.
git submodule update || exit $?
else
# Older git can't clone into an empty directory.
rmdir "$gnulib_path" 2>/dev/null
git clone --reference "$GNULIB_SRCDIR" \
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
&& git submodule init && git submodule update \
|| exit $?
fi
fi
GNULIB_SRCDIR=$gnulib_path
git submodule update || exit $?
GNULIB_SRCDIR=gnulib
fi
;;
esac
@@ -619,6 +583,7 @@ cp_mark_as_generated()
(
echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
echo '#line 1' &&
sed "s!$bt_regex/!!g" "$cp_src"
) > $cp_dst-t &&
if cmp -s "$cp_dst-t" "$cp_dst"; then
@@ -661,7 +626,7 @@ slurp() {
for excluded_file in $excluded_files; do
test "$dir/$file" = "$excluded_file" && continue 2
done
if test $file = Makefile.am && test "X$gnulib_mk" != XMakefile.am; then
if test $file = Makefile.am; then
copied=$copied${sep}$gnulib_mk; sep=$nl
remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
sed "$remove_intl" $1/$dir/$file | cmp - $dir/$gnulib_mk > /dev/null || {
@@ -679,7 +644,7 @@ slurp() {
rm -f $dir/$file
sed '
/^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
AC_DEFUN([AM_INTL_SUBDIR], [])
AC_DEFUN([AM_INTL_SUBDIR], [
/^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
$a\
@@ -768,7 +733,7 @@ find "$m4_base" "$source_base" \
# Reconfigure, getting other files.
# Skip autoheader if it's not needed.
grep -E '^[ ]*AC_CONFIG_HEADERS?\>' configure.ac >/dev/null ||
grep '^[ ]*AC_CONFIG_HEADERS\>' configure.ac >/dev/null ||
AUTOHEADER=true
for command in \
@@ -812,14 +777,13 @@ if test $with_gettext = yes; then
rm -f po/Makevars
sed '
/^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
/^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/
/^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'|
/^MSGID_BUGS_ADDRESS *=/s/=.*/= '"$MSGID_BUGS_ADDRESS"'/
/^XGETTEXT_OPTIONS *=/{
s/$/ \\/
a\
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
}
' po/Makevars.template >po/Makevars || exit 1
' po/Makevars.template >po/Makevars
if test -d runtime-po; then
# Similarly for runtime-po/Makevars, but not quite the same.
@@ -833,7 +797,7 @@ if test $with_gettext = yes; then
a\
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
}
' po/Makevars.template >runtime-po/Makevars || exit 1
' <po/Makevars.template >runtime-po/Makevars
# Copy identical files from po to runtime-po.
(cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
@@ -843,11 +807,3 @@ fi
bootstrap_epilogue
echo "$0: done. Now you can run './configure'."
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@@ -1,6 +1,6 @@
# Bootstrap configuration.
# Copyright (C) 2006-2010 Free Software Foundation, Inc.
# Copyright (C) 2006-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -40,7 +40,6 @@ gnulib_modules="
$avoided_gnulib_modules
$obsolete_gnulib_modules
acl
alignof
alloca
announce-gen
areadlink-with-size
@@ -72,9 +71,7 @@ gnulib_modules="
diacrit
dirfd
dirname
do-release-commit-and-tag
dup2
environ
error
euidaccess
exclude
@@ -93,11 +90,11 @@ gnulib_modules="
fopen-safer
fprintftime
freopen
freopen-safer
fseeko
fsusage
fsync
ftello
ftruncate
fts
getdate
getgroups
@@ -130,7 +127,6 @@ gnulib_modules="
inttostr
inttypes
isapipe
isblank
lchmod
lchown
lib-ignore
@@ -160,8 +156,6 @@ gnulib_modules="
modechange
mountlist
mpsort
netinet_in
nproc
obstack
pathmax
perl
@@ -184,8 +178,8 @@ gnulib_modules="
readutmp
realloc
regex
remove
rename
rename-dest-slash
rmdir
root-dev-ino
rpmatch
@@ -211,10 +205,9 @@ gnulib_modules="
strsignal
strtoimax
strtoumax
strverscmp
symlink
sys_ioctl
sys_stat
sys_wait
timespec
tzset
uname
@@ -222,7 +215,6 @@ gnulib_modules="
unistd-safer
unlink-busy
unlocked-io
unsetenv
update-copyright
uptime
useless-if-before-free
@@ -234,6 +226,7 @@ gnulib_modules="
verify
verror
version-etc-fsf
warnings
wcwidth
winsz-ioctl
winsz-termios
@@ -313,11 +306,11 @@ gnulib_tool_option_extras="--tests-base=$bt/gnulib-tests --with-tests"
# Build prerequisites
buildreq="\
autoconf 2.62
automake 1.11.1
autoconf 2.61
automake 1.11
autopoint -
bison -
gettext 0.18
gettext -
git 1.4.4
gperf -
gzip -
@@ -325,7 +318,6 @@ makeinfo -
perl 5.5
rsync -
tar -
xz -
"
# Automake requires that ChangeLog exist.
@@ -337,15 +329,4 @@ bootstrap_epilogue()
m=gnulib-tests/gnulib.mk
sed 's,\.\./\.\.,..,g' $m > $m-t
mv -f $m-t $m
# Since this is a "GNU" package, replace this line
# if LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null \
# | grep -v 'libtool:' >/dev/null; then
# with this:
# if true; then
# Why? That pipeline searches all files in $(top_srcdir), and if you
# happen to have large files (or apparently large sparse files), the
# first grep may well run out of memory.
perl -pi -e 's/if LC_ALL=C grep .GNU .PACKAGE.*; then/if true; then/' \
po/Makefile.in.in
}

View File

@@ -234,7 +234,7 @@
-----
Copyright (C) 2002-2010 Free Software Foundation, Inc.
Copyright (C) 2002-2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

211
cfg.mk
View File

@@ -1,5 +1,5 @@
# Customize maint.mk -*- makefile -*-
# Copyright (C) 2003-2010 Free Software Foundation, Inc.
# Copyright (C) 2003-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,12 +14,24 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Use alpha.gnu.org for alpha and beta releases.
# Use ftp.gnu.org for major releases.
gnu_ftp_host-alpha = alpha.gnu.org
gnu_ftp_host-beta = alpha.gnu.org
gnu_ftp_host-major = ftp.gnu.org
gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
# Used in maint.mk's web-manual rule
manual_title = Core GNU utilities
url_dir_list = \
ftp://$(gnu_rel_host)/gnu/$(PACKAGE)
# The GnuPG ID of the key used to sign the tarballs.
gpg_key_ID = B9AB9A16
# Tests not to run as part of "make distcheck".
local-checks-to-skip = \
sc_texinfo_acronym
local-checks-to-skip =
# Tools used to bootstrap this package, used for "announcement".
bootstrap-tools = autoconf,automake,gnulib,bison
@@ -27,13 +39,7 @@ bootstrap-tools = autoconf,automake,gnulib,bison
# Now that we have better tests, make this the default.
export VERBOSE = yes
old_NEWS_hash = 27e765279d5735f99114b57fa097e6bd
# Add an exemption for sc_makefile_at_at_check.
_makefile_at_at_check_exceptions = ' && !/^cu_install_program =/'
# Our help-version script is in a slightly different location.
_hv_file ?= $(srcdir)/tests/misc/help-version
old_NEWS_hash = 785e51bc9af87e7eb004f9ba24a0ca27
# Ensure that the list of O_ symbols used to compute O_FULLBLOCK is complete.
dd = $(srcdir)/src/dd.c
@@ -80,7 +86,7 @@ sc_root_tests:
@if test -d tests \
&& grep check-root tests/Makefile.am>/dev/null 2>&1; then \
t1=sc-root.expected; t2=sc-root.actual; \
grep -nl '^ *require_root_$$' \
grep -nl '^require_root_$$' \
$$($(VC_LIST) tests) |sed s,tests/,, |sort > $$t1; \
sed -n '/^root_tests =[ ]*\\$$/,/[^\]$$/p' \
$(srcdir)/tests/Makefile.am \
@@ -97,8 +103,7 @@ sc_root_tests:
# stays in sync with corresponding files in the repository.
sce = syntax_check_exceptions
sc_x_sc_dist_check:
@test "$$( ($(VC_LIST) | sed -n '/\.x-sc_/p' \
| sed 's|^$(_dot_escaped_srcdir)/||'; \
@test "$$( ($(VC_LIST) | sed -n '/^.x-sc_/p'; \
sed -n '/^$(sce) =[ ]*\\$$/,/[^\]$$/p' \
$(srcdir)/Makefile.am \
| sed 's/^ *//;/^$(sce) =/d' \
@@ -106,6 +111,40 @@ sc_x_sc_dist_check:
) | sort | uniq -u)" \
&& { echo 'Makefile.am: $(sce) mismatch' >&2; exit 1; } || :;
headers_with_interesting_macro_defs = \
exit.h \
fcntl_.h \
fnmatch_.h \
intprops.h \
inttypes_.h \
lchown.h \
openat.h \
stat-macros.h \
stdint_.h
# Create a list of regular expressions matching the names
# of macros that are guaranteed by parts of gnulib to be defined.
.re-defmac:
@(cd $(srcdir)/lib; \
for f in $(headers_with_interesting_macro_defs); do \
test -f $$f && \
sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f; \
done; \
) | sort -u \
| grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX' \
| sed 's/^/^# *define /' \
> $@-t
@mv $@-t $@
# Don't define macros that we already get from gnulib header files.
sc_always_defined_macros: .re-defmac
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15; \
grep -f .re-defmac $$($(VC_LIST)) \
&& { echo '$(ME): define the above via some gnulib .h file' \
1>&2; exit 1; } || :; \
fi
# Create a list of regular expressions matching the names
# of files included from system.h. Exclude a couple.
.re-list:
@@ -115,19 +154,11 @@ sc_x_sc_dist_check:
> $@-t
@mv $@-t $@
define gl_trap_
Exit () { set +e; (exit $$1); exit $$1; }; \
for sig in 1 2 3 13 15; do \
eval "trap 'Exit $$(expr $$sig + 128)' $$sig"; \
done
endef
# Files in src/ should not include directly any of
# the headers already included via system.h.
sc_system_h_headers: .re-list
@if test -f $(srcdir)/src/system.h; then \
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0; \
$(gl_trap_); \
trap 'rc=$$?; rm -f .re-list; exit $$rc' 0 1 2 3 15; \
grep -nE -f .re-list \
$$($(VC_LIST_EXCEPT) | grep '^src/') \
&& { echo '$(ME): the above are already included via system.h'\
@@ -143,26 +174,11 @@ sc_sun_os_names:
ALL_RECURSIVE_TARGETS += sc_tight_scope
sc_tight_scope:
@$(MAKE) -s -C src $@
@$(MAKE) -C src $@
ALL_RECURSIVE_TARGETS += sc_check-AUTHORS
sc_check-AUTHORS:
@$(MAKE) -s -C src $@
# Option descriptions should not start with a capital letter
# One could grep source directly as follows:
# grep -E " {2,6}-.*[^.] [A-Z][a-z]" $$($(VC_LIST_EXCEPT) | grep '\.c$$')
# but that would miss descriptions not on the same line as the -option.
ALL_RECURSIVE_TARGETS += sc_option_desc_uppercase
sc_option_desc_uppercase:
@$(MAKE) -s -C src all_programs
@$(MAKE) -s -C man $@
# Ensure all man/*.[1x] files are present
ALL_RECURSIVE_TARGETS += sc_man_file_correlation
sc_man_file_correlation:
@$(MAKE) -s -C src all_programs
@$(MAKE) -s -C man $@
@$(MAKE) -C src $@
# Perl-based tests used to exec perl from a #!/bin/sh script.
# Now they all start with #!/usr/bin/perl and the portability
@@ -175,18 +191,6 @@ sc_no_exec_perl_coreutils:
exit 1; } || :; \
fi
# Don't use "readlink" or "readlinkat" directly
sc_prohibit_readlink:
@prohibit='\<readlink(at)? \(' \
halt='do not use readlink(at); use via xreadlink or areadlink*' \
$(_sc_search_regexp)
# Don't use address of "stat" or "lstat" functions
sc_prohibit_stat_macro_address:
@prohibit='\<l?stat '':|&l?stat\>' \
halt='stat() and lstat() may be function-like macros' \
$(_sc_search_regexp)
# Ensure that date's --help output stays in sync with the info
# documentation for GNU strftime. The only exception is %N,
# which date accepts but GNU strftime does not.
@@ -196,7 +200,7 @@ sc_strftime_check:
grep '^ %. ' $(srcdir)/src/date.c | sort \
| $(extract_char) > $@-src; \
{ echo N; \
info libc date calendar format 2>/dev/null|grep '^ `%.'\'\
info libc date calendar format | grep '^ `%.'\' \
| $(extract_char); } | sort > $@-info; \
diff -u $@-src $@-info || exit 1; \
rm -f $@-src $@-info; \
@@ -204,105 +208,14 @@ sc_strftime_check:
# Indent only with spaces.
sc_prohibit_tab_based_indentation:
@prohibit='^ * ' \
halt='TAB in indentation; use only spaces' \
$(_sc_search_regexp)
@re='^ * ' \
msg='TAB in indentation; use only spaces' \
$(_prohibit_regexp)
# Don't use "indent-tabs-mode: nil" anymore. No longer needed.
sc_prohibit_emacs__indent_tabs_mode__setting:
@prohibit='^( *[*#] *)?indent-tabs-mode:' \
halt='use of emacs indent-tabs-mode: setting' \
$(_sc_search_regexp)
# Ensure that each file that contains fail=1 also contains fail=0.
# Otherwise, setting file=1 in the environment would make tests fail unexpectedly.
sc_prohibit_fail_0:
@prohibit='\<fail=0\>' \
halt='fail=0 initialization' \
$(_sc_search_regexp)
# Ensure that "stdio--.h" is used where appropriate.
sc_require_stdio_safer:
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
files=$$(grep -l '\bfreopen \?(' $$($(VC_LIST_EXCEPT) \
| grep '\.[ch]$$')); \
test -n "$$files" && grep -LE 'include "stdio--.h"' $$files \
| grep . && \
{ echo '$(ME): the above files should use "stdio--.h"' \
1>&2; exit 1; } || :; \
else :; \
fi
sc_prohibit_perl_hash_quotes:
@prohibit="\{'[A-Z_]+' *[=}]" \
halt="in Perl code, write \$$hash{KEY}, not \$$hash{'K''EY'}" \
$(_sc_search_regexp)
# Prefer xnanosleep over other less-precise sleep methods
sc_prohibit_sleep:
@prohibit='\<(nano|u)?sleep \(' \
halt='prefer xnanosleep over other sleep interfaces' \
$(_sc_search_regexp)
###########################################################
_p0 = \([^"'/]\|"\([^\"]\|[\].\)*"\|'\([^\']\|[\].\)*'
_pre = $(_p0)\|[/][^"'/*]\|[/]"\([^\"]\|[\].\)*"\|[/]'\([^\']\|[\].\)*'\)*
_pre_anchored = ^\($(_pre)\)
_comment_and_close = [^*]\|[*][^/*]\)*[*][*]*/
# help font-lock mode: '
# A sed expression that removes ANSI C and ISO C99 comments.
# Derived from the one in GNU gettext's 'moopp' preprocessor.
_sed_remove_comments = \
/[/][/*]/{ \
ta; \
:a; \
s,$(_pre_anchored)//.*,\1,; \
te; \
s,$(_pre_anchored)/[*]\($(_comment_and_close),\1 ,; \
ta; \
/^$(_pre)[/][*]/{ \
s,$(_pre_anchored)/[*].*,\1 ,; \
tu; \
:u; \
n; \
s,^\($(_comment_and_close),,; \
tv; \
s,^.*$$,,; \
bu; \
:v; \
}; \
:e; \
}
# Quote all single quotes.
_sed_rm_comments_q = $(subst ','\'',$(_sed_remove_comments))
# help font-lock mode: '
_space_before_paren_exempt =? \\n\\$$
_space_before_paren_exempt = \
(^ *\#|\\n\\$$|%s\(to %s|(date|group|character)\(s\))
# Ensure that there is a space before each open parenthesis in C code.
sc_space_before_open_paren:
@if $(VC_LIST_EXCEPT) | grep -l '\.[ch]$$' > /dev/null; then \
fail=0; \
for c in $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); do \
sed '$(_sed_rm_comments_q)' $$c 2>/dev/null \
| grep -i '[[:alnum:]](' \
| grep -vE '$(_space_before_paren_exempt)' \
| grep . && { fail=1; echo "*** $$c"; }; \
done; \
test $$fail = 1 && \
{ echo '$(ME): the above files lack a space-before-open-paren' \
1>&2; exit 1; } || :; \
else :; \
fi
# Override the default Cc: used in generating an announcement.
announcement_Cc_ = $(translation_project_), \
coreutils@gnu.org, coreutils-announce@gnu.org
@re='^( *[*#] *)?indent-tabs-mode:' \
msg='use of emacs indent-tabs-mode: setting' \
$(_prohibit_regexp)
include $(srcdir)/dist-check.mk
update-copyright-env = \
UPDATE_COPYRIGHT_USE_INTERVALS=1 \
UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79

View File

@@ -1,7 +1,7 @@
# -*- autoconf -*-
# Process this file with autoconf to produce a configure script.
# Copyright (C) 1991, 1993-2010 Free Software Foundation, Inc.
# Copyright (C) 1991, 1993-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
dnl Written by Jim Meyering.
AC_PREREQ([2.62])
AC_PREREQ([2.61])
# Make inter-release version strings look like, e.g., v6.9-219-g58ddd, which
# indicates that it is built from the 219th delta (in _some_ repository)
@@ -32,7 +32,7 @@ AC_CONFIG_SRCDIR([src/ls.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
AM_INIT_AUTOMAKE([1.11.1 dist-xz color-tests parallel-tests])
AM_INIT_AUTOMAKE([1.11 dist-xz color-tests parallel-tests])
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
AC_PROG_CC_STDC
@@ -106,7 +106,6 @@ if test "$gl_gcc_warnings" = yes; then
gl_WARN_ADD([-Wno-logical-op])
gl_WARN_ADD([-fdiagnostics-show-option])
gl_WARN_ADD([-funit-at-a-time])
AC_SUBST([WARN_CFLAGS])
@@ -114,16 +113,6 @@ if test "$gl_gcc_warnings" = yes; then
AC_DEFINE([_FORTIFY_SOURCE], [2],
[enable compile-time and run-time bounds-checking, and some warnings])
AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
# We use a slightly smaller set of warning options for lib/.
# Remove the following and save the result in GNULIB_WARN_CFLAGS.
nw=
nw="$nw -Wuninitialized"
nw="$nw -Wunused-macros"
nw="$nw -Wmissing-prototypes"
nw="$nw -Wold-style-definition"
gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
AC_SUBST([GNULIB_WARN_CFLAGS])
fi
AC_FUNC_FORK
@@ -429,10 +418,8 @@ CONFIG_STATUS_DEPENDENCIES='$(top_srcdir)/src/Makefile.am'
AC_SUBST([CONFIG_STATUS_DEPENDENCIES])
############################################################################
# As long as "grep 'PRI[diouxX]' po/*.pot" reports matches in
# translatable strings, we must use need-formatstring-macros here.
AM_GNU_GETTEXT([external], [need-formatstring-macros])
AM_GNU_GETTEXT_VERSION([0.18])
AM_GNU_GETTEXT_VERSION([0.15])
# For a test of uniq: it uses the $LOCALE_FR envvar.
gt_LOCALE_FR

View File

@@ -4,63 +4,36 @@ bin=bin-$$$$
write_loser = printf '\#!%s\necho $$0: bad path 1>&2; exit 1\n' '$(SHELL)'
tmpdir = $(abs_top_builddir)/tests/torture
t=$(tmpdir)/$(PACKAGE)/test
TMPDIR ?= /tmp
t=$(TMPDIR)/$(PACKAGE)/test
pfx=$(t)/i
built_programs = \
$$(echo 'spy:;@echo $$(bin_PROGRAMS)' \
| MAKEFLAGS= $(MAKE) -s -C src -f Makefile -f - spy \
| fmt -1 | sed 's,$(EXEEXT)$$,,' | sort -u)
# More than once, tainted build and source directory names would
# have caused at least one "make check" test to apply "chmod 700"
# to all directories under $HOME. Make sure it doesn't happen again.
tp = $(tmpdir)/taint
tp := $(shell echo "$(TMPDIR)/$(PACKAGE)-$$$$")
t_prefix = $(tp)/a
t_taint = '$(t_prefix) b'
fake_home = $(tp)/home
# When extracting from a distribution tarball, extract using the fastest
# method possible. With dist-xz, that means using the *.xz file.
ifneq ('', $(filter *.xz, $(DIST_ARCHIVES)))
tar_decompress_opt_ = J
suffix_ = xz
else
ifneq ('', $(filter *.gz, $(DIST_ARCHIVES)))
tar_decompress_opt_ = z
suffix_ = gz
else
tar_decompress_opt_ = j
suffix_ = bz2
endif
endif
amtar_extract_ = $(AMTAR) -$(tar_decompress_opt_)xf
preferred_tarball_ = $(distdir).tar.$(suffix_)
# Ensure that tests run from tainted build and src dir names work,
# and don't affect anything in $HOME. Create witness files in $HOME,
# record their attributes, and build/test. Then ensure that the
# witnesses were not affected.
# Skip this test when using libtool, since libtool-generated scripts
# cannot deal with a space-tainted srcdir.
ALL_RECURSIVE_TARGETS += taint-distcheck
taint-distcheck: $(DIST_ARCHIVES)
grep '^[ ]*LT_INIT' configure.ac >/dev/null && exit 0 || :
test -d $(t_taint) && chmod -R 700 $(t_taint) || :
-rm -rf $(t_taint) $(fake_home)
mkdir -p $(t_prefix) $(t_taint) $(fake_home)
$(amtar_extract_) $(preferred_tarball_) -C $(t_taint)
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t_taint) -zxf $(distdir).tar.gz
mkfifo $(fake_home)/fifo
touch $(fake_home)/f
mkdir -p $(fake_home)/d/e
ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-before
HOME=$(fake_home); export HOME; \
cd $(t_taint)/$(distdir) \
&& ./configure \
&& $(MAKE) \
&& $(MAKE) check \
&& HOME=$(fake_home) $(MAKE) check \
&& ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-after \
&& diff $(tp)/.ls-before $(tp)/.ls-after \
&& test -d $(t_prefix)
@@ -77,9 +50,8 @@ define install-transform-check
endef
# Install, then verify that all binaries and man pages are in place.
# Note that neither the binary, ginstall, nor the [.1 man page is installed.
# Note that neither the binary, ginstall, nor the ].1 man page is installed.
define my-instcheck
echo running my-instcheck; \
$(MAKE) prefix=$(pfx) install \
&& test ! -f $(pfx)/bin/ginstall \
&& { fail=0; \
@@ -96,16 +68,8 @@ define my-instcheck
}
endef
# The hard-linking for-loop below ensures that there is a bin/ directory
# full of all of the programs under test (except the ones that are required
# for basic Makefile rules), all symlinked to the just-built "false" program.
# This is to ensure that if ever a test neglects to make PATH include
# the build srcdir, these always-failing programs will run.
# Otherwise, it is too easy to test the wrong programs.
# Note that "false" itself is a symlink to true, so it too will malfunction.
define coreutils-path-check
{ \
echo running coreutils-path-check; \
if test -f $(srcdir)/src/true.c; then \
fail=1; \
mkdir $(bin) \
@@ -133,38 +97,37 @@ define coreutils-path-check
}
endef
# Use this to make sure we don't run these programs when building
# from a virgin compressed tarball file, below.
null_AM_MAKEFLAGS ?= \
ACLOCAL=false \
AUTOCONF=false \
AUTOMAKE=false \
AUTOHEADER=false \
GPERF=false \
MAKEINFO=false
# Use -Wformat -Werror to detect format-string/arg-list mismatches.
# Also, check for shadowing problems with -Wshadow, and for pointer
# arithmetic problems with -Wpointer-arith.
# These CFLAGS are pretty strict. If you build this target, you probably
# have to have a recent version of gcc and glibc headers.
# The hard-linking for-loop below ensures that there is a bin/ directory
# full of all of the programs under test (except the ones that are required
# for basic Makefile rules), all symlinked to the just-built "false" program.
# This is to ensure that if ever a test neglects to make PATH include
# the build srcdir, these always-failing programs will run.
# Otherwise, it is too easy to test the wrong programs.
# Note that "false" itself is a symlink to true, so it too will malfunction.
ALL_RECURSIVE_TARGETS += my-distcheck
my-distcheck: $(DIST_ARCHIVES) $(local-check)
$(MAKE) syntax-check
$(MAKE) check
-rm -rf $(t)
mkdir -p $(t)
$(amtar_extract_) $(preferred_tarball_) -C $(t)
(set -e; cd $(t)/$(distdir); \
./configure --quiet --enable-gcc-warnings --disable-nls; \
$(MAKE) AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)'; \
$(MAKE) dvi; \
$(install-transform-check); \
$(my-instcheck); \
$(coreutils-path-check); \
$(MAKE) distclean \
)
GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz
cd $(t)/$(distdir) \
&& ./configure --enable-gcc-warnings --disable-nls \
&& $(MAKE) AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \
&& $(MAKE) dvi \
&& $(install-transform-check) \
&& $(my-instcheck) \
&& $(coreutils-path-check) \
&& $(MAKE) distclean
(cd $(t) && mv $(distdir) $(distdir).old \
&& $(amtar_extract_) - ) < $(preferred_tarball_)
&& $(AMTAR) -zxf - ) < $(distdir).tar.gz
diff -ur $(t)/$(distdir).old $(t)/$(distdir)
-rm -rf $(t)
rmdir $(tmpdir)/$(PACKAGE) $(tmpdir)
@echo "========================"; \
echo "ready for distribution:"; \
for i in $(DIST_ARCHIVES); do echo " $$i"; done; \
echo "$(distdir).tar.gz is ready for distribution"; \
echo "========================"

View File

@@ -2002,7 +2002,7 @@
-----
Copyright (C) 2001-2010 Free Software Foundation, Inc.
Copyright (C) 2001-2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

View File

@@ -1,6 +1,6 @@
# Make coreutils documentation. -*-Makefile-*-
# Copyright (C) 1995-1998, 2001-2010 Free Software Foundation, Inc.
# Copyright (C) 1995-1998, 2001-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,12 +30,13 @@ EXTRA_DIST = perm.texi getdate.texi constants.texi fdl.texi
AM_MAKEINFOFLAGS = --no-split
constants.texi: $(top_srcdir)/src/tail.c $(top_srcdir)/src/shred.c
$(AM_V_GEN)LC_ALL=C; export LC_ALL; \
{ sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \
$(top_srcdir)/src/tail.c && \
sed -n -e 's/.*\(DEFAULT_PASSES\)[ =]* \([0-9]*\).*/@set SHRED_\1 \2/p'\
$(top_srcdir)/src/shred.c; } > t-$@ \
&& mv t-$@ $@
LC_ALL=C \
sed -n -e 's/^#define \(DEFAULT_MAX[_A-Z]*\) \(.*\)/@set \1 \2/p' \
$(top_srcdir)/src/tail.c > t-$@
LC_ALL=C \
sed -n -e 's/.*\(DEFAULT_PASSES\)[ =]* \([0-9]*\).*/@set SHRED_\1 \2/p'\
$(top_srcdir)/src/shred.c >> t-$@
mv t-$@ $@
MAINTAINERCLEANFILES = constants.texi
@@ -47,10 +48,8 @@ _W = (^|[^A-Za-z0-9_])
W_ = ([^A-Za-z0-9_]|$$)
syntax_checks = \
sc-avoid-builtin \
sc-avoid-io \
sc-avoid-non-zero \
sc-avoid-path \
sc-avoid-timezone \
sc-avoid-zeroes \
sc-exponent-grouping \
@@ -71,18 +70,9 @@ check-texinfo: $(syntax_checks)
$(PERL) -e 1 2> /dev/null && { $(PERL) -ne \
'/\bPOSIX\b/ && !/\@acronym{POSIX}/ && !/^\* / || /{posix}/ and print,exit 1' \
$(srcdir)/*.texi 2> /dev/null || fail=1; }; \
exit $$fail
sc-avoid-builtin:
$(AM_V_GEN)$(EGREP) -i '$(_W)builtins?$(W_)' $(srcdir)/*.texi \
&& exit 1 || :
sc-avoid-path:
$(AM_V_GEN)fail=0; \
$(EGREP) -i '$(_W)builtins?$(W_)' $(srcdir)/*.texi && fail=1; \
$(EGREP) -i '$(_W)path(name)?s?$(W_)' $(srcdir)/*.texi \
| $(EGREP) -v \
'PATH=|path search|search path|@vindex PATH$$|@env[{]PATH[}]' \
&& fail=1; \
| $(EGREP) -v 'search path|@vindex PATH$$|@env[{]PATH[}]' && fail=1; \
exit $$fail
# Use `time zone', not `timezone'.

View File

@@ -31,6 +31,7 @@
@c FIXME: the following need documentation
@c * [: (coreutils)[ invocation. File/string tests.
@c * pinky: (coreutils)pinky invocation. FIXME.
@c * mktemp: (coreutils)mktemp invocation. FIXME.
@dircategory Individual utilities
@direntry
@@ -53,7 +54,7 @@
* df: (coreutils)df invocation. Report file system disk usage.
* dir: (coreutils)dir invocation. List directories briefly.
* dircolors: (coreutils)dircolors invocation. Color setup for ls.
* dirname: (coreutils)dirname invocation. Strip last file name component.
* dirname: (coreutils)dirname invocation. Strip non-directory suffix.
* du: (coreutils)du invocation. Report on disk usage.
* echo: (coreutils)echo invocation. Print a line of text.
* env: (coreutils)env invocation. Modify the environment.
@@ -79,12 +80,10 @@
* mkdir: (coreutils)mkdir invocation. Create directories.
* mkfifo: (coreutils)mkfifo invocation. Create FIFOs (named pipes).
* mknod: (coreutils)mknod invocation. Create special files.
* mktemp: (coreutils)mktemp invocation. Create temporary files.
* mv: (coreutils)mv invocation. Rename files.
* nice: (coreutils)nice invocation. Modify niceness.
* nl: (coreutils)nl invocation. Number lines and write files.
* nohup: (coreutils)nohup invocation. Immunize to hangups.
* nproc: (coreutils)nproc invocation. Print the number of processors.
* od: (coreutils)od invocation. Dump files in octal, etc.
* paste: (coreutils)paste invocation. Merge lines of files.
* pathchk: (coreutils)pathchk invocation. Check file name portability.
@@ -139,7 +138,7 @@
This manual documents version @value{VERSION} of the @sc{gnu} core
utilities, including the standard programs for text and file manipulation.
Copyright @copyright{} 1994-1996, 2000-2010 Free Software Foundation, Inc.
Copyright @copyright{} 1994-1996, 2000-2009 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
@@ -194,10 +193,10 @@ Free Documentation License''.
* Printing text:: echo printf yes
* Conditions:: false true test expr
* Redirection:: tee
* File name manipulation:: dirname basename pathchk mktemp
* File name manipulation:: dirname basename pathchk
* Working context:: pwd stty printenv tty
* User information:: id logname whoami groups users who
* System context:: date arch nproc uname hostname hostid uptime
* System context:: date arch uname hostname hostid uptime
* SELinux context:: chcon runcon
* Modified command invocation:: chroot env nice nohup stdbuf su timeout
* Process control:: kill
@@ -377,9 +376,8 @@ Redirection
File name manipulation
* basename invocation:: Strip directory and suffix from a file name
* dirname invocation:: Strip last file name component
* dirname invocation:: Strip non-directory suffix from a file name
* pathchk invocation:: Check file name validity and portability
* mktemp invocation:: Create temporary file or directory
Working context
@@ -411,7 +409,6 @@ System context
* arch invocation:: Print machine hardware name
* date invocation:: Print or set system date and time
* nproc invocation:: Print the number of processors
* uname invocation:: Print system information
* hostname invocation:: Print or set system name
* hostid invocation:: Print numeric host identifier
@@ -577,18 +574,6 @@ Do not treat the last operand specially when it is a directory or a
symbolic link to a directory. @xref{Target directory}.
@end macro
@macro optNull{cmd}
@item -0
@opindex -0
@itemx --null
@opindex --null
@cindex output @sc{nul}-byte-terminated lines
Output a zero byte (@acronym{ASCII} @sc{nul}) at the end of each line,
rather than a newline. This option enables other programs to parse the
output of @command{\cmd\} even when that output would contain data
with embedded newlines.
@end macro
@macro optSi
@itemx --si
@opindex --si
@@ -2770,10 +2755,8 @@ If you'd like to continue to track the end of a growing file even after
it has been unlinked, use @option{--follow=descriptor}. This is the default
behavior, but it is not useful if you're tracking a log file that may be
rotated (removed or renamed, then reopened). In that case, use
@option{--follow=name} to track the named file, perhaps by reopening it
periodically to see if it has been removed and recreated by some other program.
Note that the inotify-based implementation handles this case without
the need for any periodic reopening.
@option{--follow=name} to track the named file by reopening it periodically
to see if it has been removed and recreated by some other program.
No matter which method you use, if the tracked file is determined to have
shrunk, @command{tail} prints a message saying the file has been truncated
@@ -3767,8 +3750,8 @@ the final result, after the throwing away.))
@opindex --sort
@cindex general numeric sort
@vindex LC_NUMERIC
Sort numerically, using the standard C function @code{strtold} to convert
a prefix of each line to a long double-precision floating point number.
Sort numerically, using the standard C function @code{strtod} to convert
a prefix of each line to a double-precision floating point number.
This allows floating point numbers to be specified in scientific notation,
like @code{1.0e-34} and @code{10e100}.
The @env{LC_NUMERIC} locale determines the decimal-point character.
@@ -3864,9 +3847,10 @@ To compare such strings numerically, use the
@opindex -V
@opindex --version-sort
@cindex version number sort
Sort by version name and number. It behaves like a standard sort,
except that each sequence of decimal digits is treated numerically
as an index/version number. (@xref{Details about version sort}.)
@vindex LC_NUMERIC
Sort per @code{strverscmp(3)}. This is a normal string comparison, except
that embedded decimal numbers are sorted by numeric value
(see @option{--numeric-sort} above).
@item -r
@itemx --reverse
@@ -3939,12 +3923,6 @@ multiple fields.
Example: To sort on the second field, use @option{--key=2,2}
(@option{-k 2,2}). See below for more notes on keys and more examples.
See also the @option{--debug} option to help determine the part
of the line being used in the sort.
@item --debug
Highlight the portion of each line used for sorting.
Also issue warnings about questionable usage to stderr.
@item --batch-size=@var{nmerge}
@opindex --batch-size
@@ -4120,7 +4098,7 @@ the start and end positions of a field specification, and if it is
inherited from the global options it will be attached to both.
If input lines can contain leading or adjacent blanks and @option{-t}
is not used, then @option{-k} is typically combined with @option{-b} or
an option that implicitly ignores leading blanks (@samp{Mghn}) as otherwise
an option that implicitly ignores leading blanks (@samp{MghnV}) as otherwise
the varying numbers of leading blanks in fields can cause confusing results.
If the start position in a sort field specifier falls after the end of
@@ -4132,11 +4110,6 @@ is counted from the first nonblank character of the field.
@vindex POSIXLY_CORRECT
On older systems, @command{sort} supports an obsolete origin-zero
syntax @samp{+@var{pos1} [-@var{pos2}]} for specifying sort keys.
The obsolete sequence @samp{sort +@var{a}.@var{x} -@var{b}.@var{y}}
is equivalent to @samp{sort -k @var{a+1}.@var{x+1},@var{b}} if @var{y}
is @samp{0} or absent, otherwise it is equivalent to @samp{sort -k
@var{a+1}.@var{x+1},@var{b+1}.@var{y}}.
This obsolete behavior can be enabled or disabled with the
@env{_POSIX2_VERSION} environment variable (@pxref{Standards
conformance}); it can also be enabled when @env{POSIXLY_CORRECT} is
@@ -5329,13 +5302,7 @@ of selected bytes.
Select for printing only the fields listed in @var{field-list}.
Fields are separated by a TAB character by default. Also print any
line that contains no delimiter character, unless the
@option{--only-delimited} (@option{-s}) option is specified.
Note @command{cut} does not support specifying runs of whitespace as a
delimiter, so to achieve that common functionality one can pre-process
with @command{tr} like:
@example
tr -s '[:blank:]' '\t' | cut -f@dots{}
@end example
@option{--only-delimited} (@option{-s}) option is specified
@item -d @var{input_delim_byte}
@itemx --delimiter=@var{input_delim_byte}
@@ -5479,8 +5446,6 @@ locales and options if the output of @command{sort} is fed to
sort a file on its default join field, but if you select a non-default
locale, join field, separator, or comparison options, then you should
do so consistently between @command{join} and @command{sort}.
If @samp{join -t ''} is specified then the whole line is considered which
matches the default operation of sort.
If the input has no unpairable lines, a @acronym{GNU} extension is
available; the sort order can be any order that considers two fields
@@ -5534,15 +5499,6 @@ Do not check that both input files are in sorted order. This is the default.
Replace those output fields that are missing in the input with
@var{string}.
@item --header
@opindex --header
Treat the first line of each input file as a header line. The header lines will
be joined and printed as the first output line. If @option{-o} is used to
specify output format, the header line will be printed according to the
specified format. The header lines will not be checked for ordering even if
@option{--check-order} is specified. Also if the header lines from each file
do not match, the heading fields from the first file will be used.
@item -i
@itemx --ignore-case
@opindex -i
@@ -5591,10 +5547,7 @@ option---are subject to the specified @var{field-list}.
Use character @var{char} as the input and output field separator.
Treat as significant each occurrence of @var{char} in the input file.
Use @samp{sort -t @var{char}}, without the @option{-b} option of
@samp{sort}, to produce this ordering. If @samp{join -t ''} is specified,
the whole line is considered, matching the default operation of sort.
If @samp{-t '\0'} is specified then the @acronym{ASCII} @sc{nul}
character is used to delimit the fields.
@samp{sort}, to produce this ordering.
@item -v @var{file-number}
Print a line for each unpairable line in file @var{file-number}
@@ -6717,17 +6670,23 @@ after the last @samp{.}); files with no extension are sorted first.
@node Details about version sort
@subsection Details about version sort
Version sorting handles the fact that file names frequently include indices or
version numbers. Standard sorting usually does not produce the order that one
expects because comparisons are made on a character-by-character basis.
Version sorting is especially useful when browsing directories that contain
many files with indices/version numbers in their names:
The version sort takes into account the fact that file names frequently include
indices or version numbers. Standard sorting functions usually do not produce
the ordering that people expect because comparisons are made on a
character-by-character basis. The version
sort addresses this problem, and is especially useful when browsing
directories that contain many files with indices/version numbers in their
names:
@example
$ ls -1 $ ls -1v
abc.zml-1.gz abc.zml-1.gz
abc.zml-12.gz abc.zml-2.gz
abc.zml-2.gz abc.zml-12.gz
foo.zml-1.gz foo.zml-1.gz
foo.zml-100.gz foo.zml-2.gz
foo.zml-12.gz foo.zml-6.gz
foo.zml-13.gz foo.zml-12.gz
foo.zml-2.gz foo.zml-13.gz
foo.zml-25.gz foo.zml-25.gz
foo.zml-6.gz foo.zml-100.gz
@end example
Version-sorted strings are compared such that if @var{ver1} and @var{ver2}
@@ -6746,27 +6705,11 @@ abc-1.012b.tgz abc-1.007.tgz
abc-1.01a.tgz abc-1.012b.tgz
@end example
This functionality is implemented using gnulib's @code{filevercmp} function,
which has some caveats worth noting.
@itemize @bullet
@item @env{LC_COLLATE} is ignored, which means @samp{ls -v} and @samp{sort -V}
will sort non-numeric prefixes as if the @env{LC_COLLATE} locale category
was set to @samp{C}.
@item Some suffixes will not be matched by the regular
expression mentioned above. Consequently these examples may
not sort as you expect:
@example
abc-1.2.3.4.7z
abc-1.2.3.7z
@end example
@example
abc-1.2.3.4.x86_64.rpm
abc-1.2.3.x86_64.rpm
@end example
@end itemize
This functionality is implemented using gnulib's @code{filevercmp} function.
One result of that implementation decision is that @samp{ls -v}
and @samp{sort -V} do not use the locale category, @env{LC_COLLATE},
which means non-numeric prefixes are sorted as if @env{LC_COLLATE} were set
to @samp{C}.
@node General output formatting
@subsection General output formatting
@@ -7518,18 +7461,19 @@ $ mkdir b c; (cd b; : > a; ln -s a b); cp -aL b c; ls -i1 c/b
@end smallexample
@itemx context
Preserve SELinux security context of the file, or fail with full diagnostics.
Preserve SELinux security context of the file. @command{cp} will fail
if the preserving of SELinux security context is not succesful.
@itemx xattr
Preserve extended attributes of the file, or fail with full diagnostics.
If @command{cp} is built without xattr support, ignore this option.
If SELinux context, ACLs or Capabilities are implemented using xattrs,
Preserve extended attributes if @command{cp} is built with xattr support,
and xattrs are supported and enabled on your file system.
If SELinux context and/or ACLs are implemented using xattrs,
they are preserved by this option as well.
@itemx all
Preserve all file attributes.
Equivalent to specifying all of the above, but with the difference
that failure to preserve SELinux security context or extended attributes
does not change @command{cp}'s exit status. In contrast to @option{-a},
all but @samp{Operation not supported} warnings are output.
does not change @command{cp}'s exit status.
@command{cp} does diagnose such failures.
@end table
Using @option{--preserve} with no @var{attribute_list} is equivalent
@@ -8285,9 +8229,7 @@ the destination partition and the second and third would be left on the
original partition.
@cindex extended attributes, xattr
@command{mv} always tries to copy extended attributes (xattr), which may
include SELinux context, ACLs or Capabilities.
Upon failure all but @samp{Operation not supported} warnings are output.
@command{mv} always tries to copy extended attributes (xattr).
@cindex prompting, and @command{mv}
If a destination file exists but is normally unwritable, standard input
@@ -8730,7 +8672,7 @@ The intended use of this is to shred a removed temporary file.
For example:
@example
i=`mktemp`
i=`tempfile -m 0600`
exec 3<>"$i"
rm -- "$i"
echo "Hello, world" >&3
@@ -9913,9 +9855,7 @@ touch [@var{option}]@dots{} @var{file}@dots{}
@end example
@cindex empty files, creating
Any @var{file} argument that does not exist is created empty, unless
option @option{--no-create} (@option{-c}) or @option{--no-dereference}
(@option{-h}) was in effect.
Any @var{file} argument that does not exist is created empty.
A @var{file} argument string of @samp{-} is handled specially and
causes @command{touch} to change the times of the file associated with
@@ -9929,8 +9869,8 @@ user must own the files.
Although @command{touch} provides options for changing two of the times---the
times of last access and modification---of a file, there is actually
a standard third one as well: the inode change time. This is often
referred to as a file's @code{ctime}.
a third one as well: the inode change time. This is often referred to
as a file's @code{ctime}.
The inode change time represents the time when the file's meta-information
last changed. One common example of this is when the permissions of a
file change. Changing the permissions doesn't access the file, so
@@ -9942,9 +9882,6 @@ fresh copy of the file, including the new permissions value.
Another operation that modifies a file's ctime without affecting
the others is renaming. In any case, it is not possible, in normal
operations, for a user to change the ctime field to a user-specified value.
Some operating systems and file systems support a fourth time: the
birth time, when the file was first created; by definition, this
timestamp never changes.
@vindex TZ
Time stamps assume the time zone rules specified by the @env{TZ}
@@ -9973,7 +9910,7 @@ Change the access time only.
@itemx --no-create
@opindex -c
@opindex --no-create
Do not warn about or create files that do not exist.
Do not create files that do not exist.
@item -d
@itemx --date=@var{time}
@@ -9994,24 +9931,6 @@ silently ignore any excess precision here.
@cindex BSD @command{touch} compatibility
Ignored; for compatibility with BSD versions of @command{touch}.
@item -h
@itemx --no-dereference
@opindex -h
@opindex --no-dereference
@cindex symbolic links, changing time
@findex lutimes
Attempt to change the timestamps of a symbolic link, rather than what
the link refers to. When using this option, empty files are not
created, but option @option{-c} must also be used to avoid warning
about files that do not exist. Not all systems support changing the
timestamps of symlinks, since underlying system support for this
action was not required until @acronym{POSIX} 2008. Also, on some
systems, the mere act of examining a symbolic link changes the access
time, such that only changes to the modification time will persist
long enough to be observable. When coupled with option @option{-r}, a
reference timestamp is taken from a symbolic link rather than the file
it refers to.
@item -m
@itemx --time=mtime
@itemx --time=modify
@@ -10031,8 +9950,6 @@ If this option is combined with the @option{--date=@var{time}}
the origin for any relative @var{time}s given, but is otherwise ignored.
For example, @samp{-r foo -d '-5 seconds'} specifies a time stamp
equal to five seconds before the corresponding time stamp for @file{foo}.
If @var{file} is a symbolic link, the reference timestamp is taken
from the target of the symlink, unless @option{-h} was also in effect.
@item -t [[@var{cc}]@var{yy}]@var{mmddhhmm}[.@var{ss}]
Use the argument (optional four-digit or two-digit years, months,
@@ -10427,16 +10344,22 @@ This option is equivalent to @option{--block-size=1M}.
For each symbolic links encountered by @command{du},
consider the disk space used by the symbolic link.
@item -d @var{depth}
@item --max-depth=@var{depth}
@opindex -d @var{depth}
@opindex --max-depth=@var{depth}
@cindex limiting output of @command{du}
Show the total for each directory (and file if --all) that is at
most MAX_DEPTH levels down from the root of the hierarchy. The root
is at level 0, so @code{du --max-depth=0} is equivalent to @code{du -s}.
@optNull{du}
@item -0
@opindex -0
@itemx --null
@opindex --null
@cindex output null-byte-terminated lines
Output a zero byte (@acronym{ASCII} @sc{nul}) at the end of each line,
rather than a newline. This option enables other programs to parse the
output of @command{du} even when that output would contain file names
with embedded newlines.
@optSi
@@ -10767,13 +10690,13 @@ Treat @var{size} as number of I/O blocks of the @var{file} rather than bytes.
@itemx --reference=@var{rfile}
@opindex -r
@opindex --reference
Base the size of each @var{file} on the size of @var{rfile}.
Set the size of each @var{file} to the same size as @var{rfile}.
@item -s @var{size}
@itemx --size=@var{size}
@opindex -s
@opindex --size
Set or adjust the size of each @var{file} according to @var{size}.
Set the size of each @var{file} to this @var{size}.
@multiplierSuffixesNoBlocks{size}
@var{size} may also be prefixed by one of the following to adjust
@@ -10848,8 +10771,6 @@ alert (bell)
backspace
@item \c
produce no further output
@item \e
escape
@item \f
form feed
@item \n
@@ -11922,9 +11843,8 @@ This section describes commands that manipulate file names.
@menu
* basename invocation:: Strip directory and suffix from a file name.
* dirname invocation:: Strip last file name component.
* dirname invocation:: Strip non-directory suffix from a file name.
* pathchk invocation:: Check file name validity and portability.
* mktemp invocation:: Create temporary file or directory.
@end menu
@@ -11983,7 +11903,7 @@ basename include/stdio.h .h
@node dirname invocation
@section @command{dirname}: Strip last file name component
@section @command{dirname}: Strip non-directory suffix from a file name
@pindex dirname
@cindex directory components, printing
@@ -11991,17 +11911,14 @@ basename include/stdio.h .h
@cindex non-directory suffix, stripping
@command{dirname} prints all but the final slash-delimited component of
@var{name}. Slashes on either side of the final component are also
removed. If the string contains no slash, @command{dirname} prints
@samp{.} (meaning the current directory). Synopsis:
a string (presumably a file name). Synopsis:
@example
dirname @var{name}
@end example
@var{name} need not be a file name, but if it is, this operation
effectively lists the directory that contains the final component,
including the case when the final component is itself a directory.
If @var{name} is a single component, @command{dirname} prints @samp{.}
(meaning the current directory).
@basenameAndDirname
@@ -12020,7 +11937,6 @@ Examples:
@smallexample
# Output "/usr/bin".
dirname /usr/bin/sort
dirname /usr/bin//.//
# Output ".".
dirname stdio.h
@@ -12103,180 +12019,6 @@ Exit status:
1 otherwise.
@end display
@node mktemp invocation
@section @command{mktemp}: Create temporary file or directory
@pindex mktemp
@cindex file names, creating temporary
@cindex directory, creating temporary
@cindex temporary files and directories
@command{mktemp} manages the creation of temporary files and
directories. Synopsis:
@example
mktemp [@var{option}]@dots{} [@var{template}]
@end example
Safely create a temporary file or directory based on @var{template},
and print its name. If given, @var{template} must include at least
three consecutive @samp{X}s in the last component. If omitted, the template
@samp{tmp.XXXXXXXXXX} is used, and option @option{--tmpdir} is
implied. The final run of @samp{X}s in the @var{template} will be replaced
by alpha-numeric characters; thus, on a case-sensitive file system,
and with a @var{template} including a run of @var{n} instances of @samp{X},
there are @samp{62**@var{n}} potential file names.
Older scripts used to create temporary files by simply joining the
name of the program with the process id (@samp{$$}) as a suffix.
However, that naming scheme is easily predictable, and suffers from a
race condition where the attacker can create an appropriately named
symbolic link, such that when the script then opens a handle to what
it thought was an unused file, it is instead modifying an existing
file. Using the same scheme to create a directory is slightly safer,
since the @command{mkdir} will fail if the target already exists, but
it is still inferior because it allows for denial of service attacks.
Therefore, modern scripts should use the @command{mktemp} command to
guarantee that the generated name will be unpredictable, and that
knowledge of the temporary file name implies that the file was created
by the current script and cannot be modified by other users.
When creating a file, the resulting file has read and write
permissions for the current user, but no permissions for the group or
others; these permissions are reduced if the current umask is more
restrictive.
Here are some examples (although note that if you repeat them, you
will most likely get different file names):
@itemize @bullet
@item
Create a temporary file in the current directory.
@example
$ mktemp file.XXXX
file.H47c
@end example
@item
Create a temporary file with a known suffix.
@example
$ mktemp --suffix=.txt file-XXXX
file-H08W.txt
$ mktemp file-XXXX-XXXX.txt
file-XXXX-eI9L.txt
@end example
@item
Create a secure fifo relative to the user's choice of @env{TMPDIR},
but falling back to the current directory rather than @file{/tmp}.
Note that @command{mktemp} does not create fifos, but can create a
secure directory in which the fifo can live. Exit the shell if the
directory or fifo could not be created.
@example
$ dir=$(mktemp -p "$@{TMPDIR:-.@}" -d dir-XXXX) || exit 1
$ fifo=$dir/fifo
$ mkfifo "$fifo" || @{ rmdir "$dir"; exit 1; @}
@end example
@item
Create and use a temporary file if possible, but ignore failure. The
file will reside in the directory named by @env{TMPDIR}, if specified,
or else in @file{/tmp}.
@example
$ file=$(mktemp -q) && @{
> # Safe to use $file only within this block. Use quotes,
> # since $TMPDIR, and thus $file, may contain whitespace.
> echo ... > "$file"
> rm "$file"
> @}
@end example
@item
Act as a semi-random character generator (it is not fully random,
since it is impacted by the contents of the current directory). To
avoid security holes, do not use the resulting names to create a file.
@example
$ mktemp -u XXX
Gb9
$ mktemp -u XXX
nzC
@end example
@end itemize
The program accepts the following options. Also see @ref{Common options}.
@table @samp
@item -d
@itemx --directory
@opindex -d
@opindex --directory
Create a directory rather than a file. The directory will have read,
write, and search permissions for the current user, but no permissions
for the group or others; these permissions are reduced if the current
umask is more restrictive.
@item -q
@itemx --quiet
@opindex -q
@opindex --quiet
Suppress diagnostics about failure to create a file or directory. The
exit status will still reflect whether a file was created.
@item -u
@itemx --dry-run
@opindex -u
@opindex --dry-run
Generate a temporary name that does not name an existing file, without
changing the file system contents. Using the output of this command
to create a new file is inherently unsafe, as there is a window of
time between generating the name and using it where another process
can create an object by the same name.
@item -p @var{dir}
@itemx --tmpdir[=@var{dir}]
@opindex -p
@opindex --tmpdir
Treat @var{template} relative to the directory @var{dir}. If
@var{dir} is not specified (only possible with the long option
@option{--tmpdir}) or is the empty string, use the value of
@env{TMPDIR} if available, otherwise use @samp{/tmp}. If this is
specified, @var{template} must not be absolute. However,
@var{template} can still contain slashes, although intermediate
directories must already exist.
@item --suffix=@var{suffix}
@opindex --suffix
Append @var{suffix} to the @var{template}. @var{suffix} must not
contain slash. If @option{--suffix} is specified, @var{template} must
end in @samp{X}; if it is not specified, then an appropriate
@option{--suffix} is inferred by finding the last @samp{X} in
@var{template}. This option exists for use with the default
@var{template} and for the creation of a @var{suffix} that starts with
@samp{X}.
@item -t
@opindex -t
Treat @var{template} as a single file relative to the value of
@env{TMPDIR} if available, or to the directory specified by
@option{-p}, otherwise to @samp{/tmp}. @var{template} must not
contain slashes. This option is deprecated; the use of @option{-p}
without @option{-t} offers better defaults (by favoring the command
line over @env{TMPDIR}) and more flexibility (by allowing intermediate
directories).
@end table
@cindex exit status of @command{mktemp}
Exit status:
@display
0 if the file was created,
1 otherwise.
@end display
@node Working context
@chapter Working context
@@ -13039,13 +12781,8 @@ If no @var{variable}s are specified, @command{printenv} prints the value of
every environment variable. Otherwise, it prints the value of each
@var{variable} that is set, and nothing for those that are not set.
The program accepts the following option. Also see @ref{Common options}.
@table @samp
@optNull{printenv}
@end table
The only options are a lone @option{--help} or @option{--version}.
@xref{Common options}.
@cindex exit status of @command{printenv}
Exit status:
@@ -13459,7 +13196,6 @@ information.
@menu
* date invocation:: Print or set system date and time.
* arch invocation:: Print machine hardware name.
* nproc invocation:: Print the number of processors.
* uname invocation:: Print system information.
* hostname invocation:: Print or set system name.
* hostid invocation:: Print numeric host identifier.
@@ -14119,43 +13855,6 @@ The program accepts the @ref{Common options} only.
@exitstatus
@node nproc invocation
@section @command{nproc}: Print the number of available processors
@pindex nproc
@cindex Print the number of processors
@cindex system information, printing
Print the number of processing units available to the current process,
which may be less than the number of online processors.
If this information is not accessible, then print the number of
processors installed. If the @env{OMP_NUM_THREADS} environment variable is
set, then it will determine the returned value. The result is guaranteed to be
greater than zero. Synopsis:
@example
nproc [@var{option}]
@end example
The program accepts the following options. Also see @ref{Common options}.
@table @samp
@item --all
@opindex --all
Print the number of installed processors on the system, which may
be greater than the number online or available to the current process.
The @env{OMP_NUM_THREADS} environment variable is not honored in this case.
@item --ignore=@var{number}
@opindex --ignore
If possible, exclude this @var{number} of processing units.
@end table
@exitstatus
@node uname invocation
@section @command{uname}: Print system information
@@ -14639,7 +14338,7 @@ device files), copy them into place, too.
Exit status:
@display
125 if @command{chroot} itself fails
1 if @command{chroot} itself fails
126 if @var{command} is found but cannot be invoked
127 if @var{command} cannot be found
the exit status of @var{command} otherwise
@@ -14684,89 +14383,17 @@ remaining arguments are passed as arguments to that program.
The program should not be a special built-in utility
(@pxref{Special built-in utilities}).
Modifications to @env{PATH} take effect prior to searching for
@var{command}. Use caution when reducing @env{PATH}; behavior is
not portable when @env{PATH} is undefined or omits key directories
such as @file{/bin}.
In the rare case that a utility contains a @samp{=} in the name, the
only way to disambiguate it from a variable assignment is to use an
intermediate command for @var{command}, and pass the problematic
program name via @var{args}. For example, if @file{./prog=} is an
executable in the current @env{PATH}:
@example
env prog= true # runs 'true', with prog= in environment
env ./prog= true # runs 'true', with ./prog= in environment
env -- prog= true # runs 'true', with prog= in environment
env sh -c '\prog= true' # runs 'prog=' with argument 'true'
env sh -c 'exec "$@@"' sh prog= true # also runs 'prog='
@end example
@cindex environment, printing
If no command name is specified following the environment
specifications, the resulting environment is printed. This is like
specifying the @command{printenv} program.
For some examples, suppose the environment passed to @command{env}
contains @samp{LOGNAME=rms}, @samp{EDITOR=emacs}, and
@samp{PATH=.:/gnubin:/hacks}:
@itemize @bullet
@item
Output the current environment.
@example
$ env | LC_ALL=C sort
EDITOR=emacs
LOGNAME=rms
PATH=.:/gnubin:/hacks
@end example
@item
Run @command{foo} with a reduced environment, preserving only the
original @env{PATH} to avoid problems in locating @command{foo}.
@example
env - PATH="$PATH" foo
@end example
@item
Run @command{foo} with the environment containing @samp{LOGNAME=rms},
@samp{EDITOR=emacs}, and @samp{PATH=.:/gnubin:/hacks}, and guarantees
that @command{foo} was found in the file system rather than as a shell
built-in.
@example
env foo
@end example
@item
Run @command{nemacs} with the environment containing @samp{LOGNAME=foo},
@samp{EDITOR=emacs}, @samp{PATH=.:/gnubin:/hacks}, and
@samp{DISPLAY=gnu:0}.
@example
env DISPLAY=gnu:0 LOGNAME=foo nemacs
@end example
@item
Attempt to run the program @command{/energy/--} (as that is the only
possible path search result); if the command exists, the environment
will contain @samp{LOGNAME=rms} and @samp{PATH=/energy}, and the
arguments will be @samp{e=mc2}, @samp{bar}, and @samp{baz}.
@example
env -u EDITOR PATH=/energy -- e=mc2 bar baz
@end example
@end itemize
The program accepts the following options. Also see @ref{Common options}.
Options must precede operands.
@table @samp
@optNull{env}
@item -u @var{name}
@itemx --unset=@var{name}
@opindex -u
@@ -14789,7 +14416,7 @@ Exit status:
@display
0 if no @var{command} is specified and the environment is output
125 if @command{env} itself fails
1 if @command{env} itself fails
126 if @var{command} is found but cannot be invoked
127 if @var{command} cannot be found
the exit status of @var{command} otherwise
@@ -14864,7 +14491,7 @@ Exit status:
@display
0 if no @var{command} is specified and the niceness is output
125 if @command{nice} itself fails
1 if @command{nice} itself fails
126 if @var{command} is found but cannot be invoked
127 if @var{command} cannot be found
the exit status of @var{command} otherwise
@@ -14982,15 +14609,11 @@ options}. Options must precede operands.
Exit status:
@display
125 if @command{nohup} itself fails, and @env{POSIXLY_CORRECT} is not set
126 if @var{command} is found but cannot be invoked
127 if @var{command} cannot be found
127 if @command{nohup} itself fails or if @var{command} cannot be found
the exit status of @var{command} otherwise
@end display
If @env{POSIXLY_CORRECT} is set, internal failures give status 127
instead of 125.
@node stdbuf invocation
@section @command{stdbuf}: Run a command with modified I/O stream buffering
@@ -15195,7 +14818,7 @@ shell is restricted (see @option{-m} just above).
Exit status:
@display
125 if @command{su} itself fails
1 if @command{su} itself fails
126 if subshell is found but cannot be invoked
127 if subshell cannot be found
the exit status of the subshell otherwise
@@ -15239,25 +14862,31 @@ might find this idea strange at first.
still running after the specified time interval. Synopsis:
@example
timeout [@var{option}] @var{duration} @var{command} [@var{arg}]@dots{}
timeout [@var{option}] @var{number}[smhd] @var{command} [@var{arg}]@dots{}
@end example
@cindex time units
@var{number} is an integer followed by an optional unit; the default
is seconds. The units are:
@table @samp
@item s
seconds
@item m
minutes
@item h
hours
@item d
days
@end table
@var{command} must not be a special built-in utility (@pxref{Special
built-in utilities}).
The program accepts the following options. Also see @ref{Common options}.
The program accepts the following option. Also see @ref{Common options}.
Options must precede operands.
@table @samp
@item -k @var{duration}
@itemx --kill-after=@var{duration}
@opindex -k
@opindex --kill-after
Ensure the monitored @var{command} is killed by also sending a @samp{KILL}
signal, after the specified @var{duration}. Without this option, if the
selected signal proves not to be fatal, @command{timeout} does not kill
the @var{command}.
@item -s @var{signal}
@itemx --signal=@var{signal}
@opindex -s
@@ -15265,17 +14894,8 @@ the @var{command}.
Send this @var{signal} to @var{command} on timeout, rather than the
default @samp{TERM} signal. @var{signal} may be a name like @samp{HUP}
or a number. Also see @xref{Signal specifications}.
@end table
@cindex time units
@var{duration} is an integer followed by an optional unit:
@display
@samp{s} for seconds (the default)
@samp{m} for minutes
@samp{h} for hours
@samp{d} for days
@end display
A duration of 0 disables the associated timeout.
@end table
@cindex exit status of @command{timeout}
Exit status:
@@ -15482,7 +15102,7 @@ M8=`echo 2^31-1|bc` ; M9=`echo 2^61-1|bc`
Similarly, factoring the eighth Fermat number @math{2^{256}+1} takes
about 20 seconds on the same machine.
Factoring large numbers is, in general, hard. The Pollard Rho
Factoring large prime numbers is, in general, hard. The Pollard Rho
algorithm used by @command{factor} is particularly effective for
numbers with relatively small factors. If you wish to factor large
numbers which do not have small factors (for example, numbers which

View File

@@ -1,7 +1,7 @@
@c File mode bits
@c Copyright (C) 1994, 1996, 1999-2001, 2003-2006, 2008-2010 Free Software
@c Foundation, Inc.
@c Copyright (C) 1994, 1996, 1999-2001, 2003-2006,
@c 2008-2009 Free Software Foundation, Inc.
@c Permission is granted to copy, distribute and/or modify this document
@c under the terms of the GNU Free Documentation License, Version 1.3 or

View File

@@ -1,5 +1,5 @@
/* Align/Truncate a string in a given screen width
Copyright (C) 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -32,7 +32,6 @@
#endif
/* Replace non printable chars.
Note \t and \n etc. are non printable.
Return 1 if replacement made, 0 otherwise. */
static bool
@@ -120,12 +119,12 @@ mbs_align_pad (char *dest, const char* dest_end, size_t n_spaces)
ALIGNMENT specifies whether to left- or right-justify or to center.
If SRC requires more than *WIDTH columns, truncate it to fit.
When centering, the number of trailing spaces may be one less than the
number of leading spaces.
number of leading spaces. The FLAGS parameter is unused at present.
Return the length in bytes required for the final result, not counting
the trailing NUL. A return value of DEST_SIZE or larger means there
wasn't enough space. DEST will be NUL terminated in any case.
Return (size_t) -1 upon error (invalid multi-byte sequence in SRC,
or malloc failure), unless MBA_UNIBYTE_FALLBACK is specified.
or malloc failure).
Update *WIDTH to indicate how many columns were used before padding. */
size_t
@@ -150,22 +149,12 @@ mbsalign (const char *src, char *dest, size_t dest_size,
{
size_t src_chars = mbstowcs (NULL, src, 0);
if (src_chars == (size_t) -1)
{
if (flags & MBA_UNIBYTE_FALLBACK)
goto mbsalign_unibyte;
else
goto mbsalign_cleanup;
}
goto mbsalign_cleanup;
src_chars += 1; /* make space for NUL */
str_wc = malloc (src_chars * sizeof (wchar_t));
if (str_wc == NULL)
{
if (flags & MBA_UNIBYTE_FALLBACK)
goto mbsalign_unibyte;
else
goto mbsalign_cleanup;
}
if (mbstowcs (str_wc, src, src_chars) != 0)
goto mbsalign_cleanup;
if (mbstowcs (str_wc, src, src_chars) > 0)
{
str_wc[src_chars - 1] = L'\0';
wc_enabled = true;
@@ -176,36 +165,27 @@ mbsalign (const char *src, char *dest, size_t dest_size,
/* If we transformed or need to truncate the source string
then create a modified copy of it. */
if (wc_enabled && (conversion || (n_cols > *width)))
if (conversion || (n_cols > *width))
{
if (conversion)
{
/* May have increased the size by converting
\t to \uFFFD for example. */
src_size = wcstombs (NULL, str_wc, 0) + 1;
}
newstr = malloc (src_size);
if (newstr == NULL)
newstr = malloc (src_size);
if (newstr == NULL)
goto mbsalign_cleanup;
str_to_print = newstr;
if (wc_enabled)
{
if (flags & MBA_UNIBYTE_FALLBACK)
goto mbsalign_unibyte;
else
goto mbsalign_cleanup;
n_cols = wc_truncate (str_wc, *width);
n_used_bytes = wcstombs (newstr, str_wc, src_size);
}
else
{
n_cols = *width;
n_used_bytes = n_cols;
memcpy (newstr, src, n_cols);
newstr[n_cols] = '\0';
}
str_to_print = newstr;
n_cols = wc_truncate (str_wc, *width);
n_used_bytes = wcstombs (newstr, str_wc, src_size);
}
mbsalign_unibyte:
if (n_cols > *width) /* Unibyte truncation required. */
{
n_cols = *width;
n_used_bytes = n_cols;
}
if (*width > n_cols) /* Padding required. */
if (*width > n_cols)
n_spaces = *width - n_cols;
/* indicate to caller how many cells needed (not including padding). */
@@ -217,11 +197,16 @@ mbsalign_unibyte:
/* Write as much NUL terminated output to DEST as possible. */
if (dest_size != 0)
{
size_t start_spaces, end_spaces;
char *dest_end = dest + dest_size - 1;
size_t start_spaces = n_spaces / 2 + n_spaces % 2;
size_t end_spaces = n_spaces / 2;
switch (align)
{
case MBS_ALIGN_CENTER:
start_spaces = n_spaces / 2 + n_spaces % 2;
end_spaces = n_spaces / 2;
break;
case MBS_ALIGN_LEFT:
start_spaces = 0;
end_spaces = n_spaces;
@@ -230,16 +215,10 @@ mbsalign_unibyte:
start_spaces = n_spaces;
end_spaces = 0;
break;
case MBS_ALIGN_CENTER:
default:
start_spaces = n_spaces / 2 + n_spaces % 2;
end_spaces = n_spaces / 2;
break;
}
dest = mbs_align_pad (dest, dest_end, start_spaces);
size_t space_left = dest_end - dest;
dest = mempcpy (dest, str_to_print, MIN (n_used_bytes, space_left));
dest = mempcpy(dest, str_to_print, MIN (n_used_bytes, dest_end - dest));
mbs_align_pad (dest, dest_end, end_spaces);
}
@@ -250,39 +229,3 @@ mbsalign_cleanup:
return ret;
}
/* A wrapper around mbsalign() to dynamically allocate the
minimum amount of memory to store the result.
Return NULL on failure. */
char *
ambsalign (const char *src, size_t *width, mbs_align_t align, int flags)
{
size_t orig_width = *width;
size_t size = *width; /* Start with enough for unibyte mode. */
size_t req = size;
char *buf = NULL;
while (req >= size)
{
size = req + 1; /* Space for NUL. */
char *nbuf = realloc (buf, size);
if (nbuf == NULL)
{
free (buf);
buf = NULL;
break;
}
buf = nbuf;
*width = orig_width;
req = mbsalign (src, buf, size, width, align, flags);
if (req == (size_t) -1)
{
free (buf);
buf = NULL;
break;
}
}
return buf;
}

View File

@@ -1,5 +1,5 @@
/* Align/Truncate a string in a given screen width
Copyright (C) 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,29 +18,6 @@
typedef enum { MBS_ALIGN_LEFT, MBS_ALIGN_RIGHT, MBS_ALIGN_CENTER } mbs_align_t;
enum {
/* Use unibyte mode for invalid multibyte strings or
or when heap memory is exhausted. */
MBA_UNIBYTE_FALLBACK = 0x0001,
#if 0 /* Other possible options. */
/* Skip invalid multibyte chars rather than failing */
MBA_IGNORE_INVALID = 0x0002,
/* Align multibyte strings using "figure space" (\u2007) */
MBA_USE_FIGURE_SPACE = 0x0004,
/* Don't add any padding */
MBA_TRUNCATE_ONLY = 0x0008,
/* Don't truncate */
MBA_PAD_ONLY = 0x0010,
#endif
};
size_t
mbsalign (const char *src, char *dest, size_t dest_size,
size_t *width, mbs_align_t align, int flags);
char *
ambsalign (const char *src, size_t *width, mbs_align_t align, int flags);

142
gl/lib/mgetgroups.c Normal file
View File

@@ -0,0 +1,142 @@
/* mgetgroups.c -- return a list of the groups a user is in
Copyright (C) 2007-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Extracted from coreutils' src/id.c. */
#include <config.h>
#include "mgetgroups.h"
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#if HAVE_GETGROUPLIST
# include <grp.h>
#endif
#include "getugroups.h"
#include "xalloc.h"
static GETGROUPS_T *
realloc_groupbuf (GETGROUPS_T *g, size_t num)
{
if (xalloc_oversized (num, sizeof (*g)))
{
errno = ENOMEM;
return NULL;
}
return realloc (g, num * sizeof (*g));
}
/* Like getugroups, but store the result in malloc'd storage.
Set *GROUPS to the malloc'd list of all group IDs of which USERNAME
is a member. If GID is not -1, store it first. GID should be the
group ID (pw_gid) obtained from getpwuid, in case USERNAME is not
listed in the groups database (e.g., /etc/groups). Upon failure,
don't modify *GROUPS, set errno, and return -1. Otherwise, return
the number of groups. */
int
mgetgroups (char const *username, gid_t gid, GETGROUPS_T **groups)
{
int max_n_groups;
int ng;
GETGROUPS_T *g;
#if HAVE_GETGROUPLIST
/* We prefer to use getgrouplist if available, because it has better
performance characteristics.
In glibc 2.3.2, getgrouplist is buggy. If you pass a zero as the
length of the output buffer, getgrouplist will still write to the
buffer. Contrary to what some versions of the getgrouplist
manpage say, this doesn't happen with nonzero buffer sizes.
Therefore our usage here just avoids a zero sized buffer. */
if (username)
{
enum { N_GROUPS_INIT = 10 };
max_n_groups = N_GROUPS_INIT;
g = realloc_groupbuf (NULL, max_n_groups);
if (g == NULL)
return -1;
while (1)
{
GETGROUPS_T *h;
int last_n_groups = max_n_groups;
/* getgrouplist updates max_n_groups to num required. */
ng = getgrouplist (username, gid, g, &max_n_groups);
/* Some systems (like Darwin) have a bug where they
never increase max_n_groups. */
if (ng < 0 && last_n_groups == max_n_groups)
max_n_groups *= 2;
if ((h = realloc_groupbuf (g, max_n_groups)) == NULL)
{
int saved_errno = errno;
free (g);
errno = saved_errno;
return -1;
}
g = h;
if (0 <= ng)
{
*groups = g;
/* On success some systems just return 0 from getgrouplist,
so return max_n_groups rather than ng. */
return max_n_groups;
}
}
}
/* else no username, so fall through and use getgroups. */
#endif
max_n_groups = (username
? getugroups (0, NULL, username, gid)
: getgroups (0, NULL));
/* If we failed to count groups with NULL for a buffer,
try again with a non-NULL one, just in case. */
if (max_n_groups < 0)
max_n_groups = 5;
g = realloc_groupbuf (NULL, max_n_groups);
if (g == NULL)
return -1;
ng = (username
? getugroups (max_n_groups, g, username, gid)
: getgroups (max_n_groups, g));
if (ng < 0)
{
int saved_errno = errno;
free (g);
errno = saved_errno;
return -1;
}
*groups = g;
return ng;
}

19
gl/lib/mgetgroups.h Normal file
View File

@@ -0,0 +1,19 @@
/* Get a list of all group IDs associated with a specified user ID.
Copyright (C) 2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <sys/types.h>
int mgetgroups (const char *username, gid_t gid, GETGROUPS_T **groups);

View File

@@ -1,6 +1,6 @@
/* Bob Jenkins's cryptographic random number generator, ISAAC.
Copyright (C) 1999-2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 1999-2006, 2009 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999 Colin Plumb.
This program is free software: you can redistribute it and/or modify

View File

@@ -1,6 +1,6 @@
/* Bob Jenkins's cryptographic random number generator, ISAAC.
Copyright (C) 1999-2005, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 1999-2005, 2009 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999 Colin Plumb.
This program is free software: you can redistribute it and/or modify

View File

@@ -1,6 +1,6 @@
/* Generate random integers.
Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -125,7 +125,7 @@ randint_genmax (struct randint_source *s, randint genmax)
randint randmax = s->randmax;
randint choices = genmax + 1;
while (1)
for (;;)
{
if (randmax < genmax)
{

View File

@@ -1,6 +1,6 @@
/* Generate random integers.
Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* Generate random permutations.
Copyright (C) 2006-2007, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* Generate buffers of random data.
Copyright (C) 2006, 2008-2010 Free Software Foundation, Inc.
Copyright (C) 2006, 2008-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -199,7 +199,7 @@ randread_set_handler_arg (struct randread_source *s, void const *handler_arg)
static void
readsource (struct randread_source *s, unsigned char *p, size_t size)
{
while (true)
for (;;)
{
size_t inbytes = fread (p, sizeof *p, size, s->source);
int fread_errno = errno;
@@ -221,7 +221,7 @@ readisaac (struct isaac *isaac, unsigned char *p, size_t size)
{
size_t inbytes = isaac->buffered;
while (true)
for (;;)
{
if (size <= inbytes)
{

View File

@@ -1,6 +1,6 @@
/* Generate buffers of random data.
Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,63 +0,0 @@
diff --git a/lib/regcomp.c b/lib/regcomp.c
index d5968bd..4926676 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -541,7 +541,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
size_t errbuf_size;
#else /* size_t might promote */
size_t
-regerror (int errcode, const regex_t *_Restrict_ preg,
+regerror (int errcode, const regex_t *_Restrict_ preg _UNUSED_PARAMETER_,
char *_Restrict_ errbuf, size_t errbuf_size)
#endif
{
@@ -1383,7 +1383,7 @@ calc_first (void *extra, bin_tree_t *node)
/* Pass 2: compute NEXT on the tree. Preorder visit. */
static reg_errcode_t
-calc_next (void *extra, bin_tree_t *node)
+calc_next (void *extra _UNUSED_PARAMETER_, bin_tree_t *node)
{
switch (node->token.type)
{
@@ -2744,7 +2744,8 @@ static reg_errcode_t
internal_function
build_collating_symbol (bitset_t sbcset,
# ifdef RE_ENABLE_I18N
- re_charset_t *mbcset, Idx *coll_sym_alloc,
+ re_charset_t *mbcset _UNUSED_PARAMETER_,
+ Idx *coll_sym_alloc _UNUSED_PARAMETER_,
# endif
const unsigned char *name)
{
@@ -3323,7 +3324,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
static reg_errcode_t
parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp,
- re_token_t *token, int token_len, re_dfa_t *dfa,
+ re_token_t *token, int token_len,
+ re_dfa_t *dfa _UNUSED_PARAMETER_,
reg_syntax_t syntax, bool accept_hyphen)
{
#ifdef RE_ENABLE_I18N
@@ -3410,8 +3412,9 @@ parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp,
static reg_errcode_t
#ifdef RE_ENABLE_I18N
-build_equiv_class (bitset_t sbcset, re_charset_t *mbcset,
- Idx *equiv_class_alloc, const unsigned char *name)
+build_equiv_class (bitset_t sbcset, re_charset_t *mbcset _UNUSED_PARAMETER_,
+ Idx *equiv_class_alloc _UNUSED_PARAMETER_,
+ const unsigned char *name)
#else /* not RE_ENABLE_I18N */
build_equiv_class (bitset_t sbcset, const unsigned char *name)
#endif /* not RE_ENABLE_I18N */
@@ -3816,7 +3819,7 @@ free_token (re_token_t *node)
and its children. */
static reg_errcode_t
-free_tree (void *extra, bin_tree_t *node)
+free_tree (void *extra _UNUSED_PARAMETER_, bin_tree_t *node)
{
free_token (&node->token);
return REG_NOERROR;

View File

@@ -1,25 +0,0 @@
diff --git a/lib/regex_internal.c b/lib/regex_internal.c
index 904b88e..61c8d9d 100644
--- a/lib/regex_internal.c
+++ b/lib/regex_internal.c
@@ -18,6 +18,8 @@
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+#include "verify.h"
+#include "intprops.h"
static void re_string_construct_common (const char *str, Idx len,
re_string_t *pstr,
RE_TRANSLATE_TYPE trans, bool icase,
@@ -1390,7 +1392,10 @@ static void
internal_function
re_node_set_remove_at (re_node_set *set, Idx idx)
{
- if (idx < 0 || idx >= set->nelem)
+ verify (! TYPE_SIGNED (Idx));
+ /* if (idx < 0)
+ return; */
+ if (idx >= set->nelem)
return;
--set->nelem;
for (; idx < set->nelem; idx++)

View File

@@ -1,14 +0,0 @@
diff --git i/lib/regex_internal.h w/lib/regex_internal.h
index 859832f..3c7fe06 100644
--- i/lib/regex_internal.h
+++ w/lib/regex_internal.h
@@ -826,7 +826,8 @@ re_string_wchar_at (const re_string_t *pstr, Idx idx)
static int
internal_function __attribute ((pure))
-re_string_elem_size_at (const re_string_t *pstr, Idx idx)
+re_string_elem_size_at (const re_string_t *pstr _UNUSED_PARAMETER_,
+ Idx idx _UNUSED_PARAMETER_)
{
# ifdef _LIBC
const unsigned char *p, *extra;

View File

@@ -1,45 +0,0 @@
diff --git a/lib/regexec.c b/lib/regexec.c
index 21a8166..7762437 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -18,6 +18,8 @@
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+#include "verify.h"
+#include "intprops.h"
static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags,
Idx n) internal_function;
static void match_ctx_clean (re_match_context_t *mctx) internal_function;
@@ -378,8 +380,11 @@ re_search_2_stub (struct re_pattern_buffer *bufp,
Idx len = length1 + length2;
char *s = NULL;
- if (BE (length1 < 0 || length2 < 0 || stop < 0 || len < length1, 0))
- return -2;
+ verify (! TYPE_SIGNED (Idx));
+ if (BE (len < length1, 0))
+ return -2;
+ /* if (BE (length1 < 0 || length2 < 0 || stop < 0, 0))
+ return -2; */
/* Concatenate the strings. */
if (length2 > 0)
@@ -431,11 +436,14 @@ re_search_stub (struct re_pattern_buffer *bufp,
Idx last_start = start + range;
/* Check for out-of-range. */
- if (BE (start < 0 || start > length, 0))
- return -1;
+ verify (! TYPE_SIGNED (Idx));
+ /* if (BE (start < 0, 0))
+ return -1; */
+ if (BE (start > length, 0))
+ return -1;
if (BE (length < last_start || (0 <= range && last_start < start), 0))
last_start = length;
- else if (BE (last_start < 0 || (range < 0 && start <= last_start), 0))
+ else if (BE (/* last_start < 0 || */ (range < 0 && start <= last_start), 0))
last_start = 0;
__libc_lock_lock (dfa->lock);

View File

@@ -1,5 +1,5 @@
/* root-dev-ino.c -- get the device and inode numbers for `/'.
Copyright (C) 2003, 2005-2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2003, 2005, 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* Root device and inode number checking.
Copyright (C) 2003, 2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2003, 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

294
gl/lib/tempname.c Normal file
View File

@@ -0,0 +1,294 @@
/* tempname.c - generate the name of a temporary file.
Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Extracted from glibc sysdeps/posix/tempname.c. See also tmpdir.c. */
#if !_LIBC
# include <config.h>
# include "tempname.h"
# include "randint.h"
#endif
#include <sys/types.h>
#include <assert.h>
#include <errno.h>
#ifndef __set_errno
# define __set_errno(Val) errno = (Val)
#endif
#include <stdio.h>
#ifndef P_tmpdir
# define P_tmpdir "/tmp"
#endif
#ifndef TMP_MAX
# define TMP_MAX 238328
#endif
#ifndef __GT_FILE
# define __GT_FILE 1
# define __GT_DIR 2
# define __GT_NOCREATE 3
#endif
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <sys/time.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/stat.h>
#if _LIBC
# define struct_stat64 struct stat64
#else
# define struct_stat64 struct stat
# define __open open
# define __gen_tempname gen_tempname
# define __getpid getpid
# define __gettimeofday gettimeofday
# define __mkdir mkdir
# define __lxstat64(version, file, buf) lstat (file, buf)
# define __xstat64(version, file, buf) stat (file, buf)
#endif
#if ! (HAVE___SECURE_GETENV || _LIBC)
# define __secure_getenv getenv
#endif
#if _LIBC
/* Return nonzero if DIR is an existent directory. */
static int
direxists (const char *dir)
{
struct_stat64 buf;
return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode);
}
/* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is
non-null and exists, uses it; otherwise uses the first of $TMPDIR,
P_tmpdir, /tmp that exists. Copies into TMPL a template suitable
for use with mk[s]temp. Will fail (-1) if DIR is non-null and
doesn't exist, none of the searched dirs exists, or there's not
enough space in TMPL. */
int
__path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
int try_tmpdir)
{
const char *d;
size_t dlen, plen;
if (!pfx || !pfx[0])
{
pfx = "file";
plen = 4;
}
else
{
plen = strlen (pfx);
if (plen > 5)
plen = 5;
}
if (try_tmpdir)
{
d = __secure_getenv ("TMPDIR");
if (d != NULL && direxists (d))
dir = d;
else if (dir != NULL && direxists (dir))
/* nothing */ ;
else
dir = NULL;
}
if (dir == NULL)
{
if (direxists (P_tmpdir))
dir = P_tmpdir;
else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
dir = "/tmp";
else
{
__set_errno (ENOENT);
return -1;
}
}
dlen = strlen (dir);
while (dlen > 1 && dir[dlen - 1] == '/')
dlen--; /* remove trailing slashes */
/* check we have room for "${dir}/${pfx}XXXXXX\0" */
if (tmpl_len < dlen + 1 + plen + 6 + 1)
{
__set_errno (EINVAL);
return -1;
}
sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
return 0;
}
#endif /* _LIBC */
static inline bool
check_x_suffix (char const *s, size_t len)
{
return strspn (s, "X") == len;
}
/* These are the characters used in temporary file names. */
static const char letters[] =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
/* Generate a temporary file name based on TMPL. TMPL must end in a
a sequence of at least X_SUFFIX_LEN "X"s. The name constructed
does not exist at the time of the call to __gen_tempname. TMPL is
overwritten with the result.
KIND may be one of:
__GT_NOCREATE: simply verify that the name does not exist
at the time of the call.
__GT_FILE: create the file using open(O_CREAT|O_EXCL)
and return a read-write fd. The file is mode 0600.
__GT_DIR: create a directory, which will be mode 0700.
We use a clever algorithm to get hard-to-predict names. */
int
gen_tempname_len (char *tmpl, int flags, int kind, size_t x_suffix_len)
{
size_t len;
char *XXXXXX;
unsigned int count;
int fd = -1;
int save_errno = errno;
struct_stat64 st;
struct randint_source *rand_src;
/* A lower bound on the number of temporary files to attempt to
generate. The maximum total number of temporary file names that
can exist for a given template is 62**6. It should never be
necessary to try all these combinations. Instead if a reasonable
number of names is tried (we define reasonable as 62**3) fail to
give the system administrator the chance to remove the problems. */
#define ATTEMPTS_MIN (62 * 62 * 62)
/* The number of times to attempt to generate a temporary file. To
conform to POSIX, this must be no smaller than TMP_MAX. */
#if ATTEMPTS_MIN < TMP_MAX
unsigned int attempts = TMP_MAX;
#else
unsigned int attempts = ATTEMPTS_MIN;
#endif
len = strlen (tmpl);
if (len < x_suffix_len || ! check_x_suffix (&tmpl[len - x_suffix_len],
x_suffix_len))
{
__set_errno (EINVAL);
return -1;
}
rand_src = randint_all_new (NULL, 8);
if (! rand_src)
return -1;
/* This is where the Xs start. */
XXXXXX = &tmpl[len - x_suffix_len];
for (count = 0; count < attempts; ++count)
{
size_t i;
for (i = 0; i < x_suffix_len; i++)
{
XXXXXX[i] = letters[randint_genmax (rand_src, sizeof letters - 2)];
}
switch (kind)
{
case __GT_FILE:
fd = __open (tmpl,
(flags & ~0777) | O_RDWR | O_CREAT | O_EXCL,
S_IRUSR | S_IWUSR);
break;
case __GT_DIR:
fd = __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
break;
case __GT_NOCREATE:
/* This case is backward from the other three. This function
succeeds if __xstat fails because the name does not exist.
Note the continue to bypass the common logic at the bottom
of the loop. */
if (__lxstat64 (_STAT_VER, tmpl, &st) < 0)
{
if (errno == ENOENT)
{
__set_errno (save_errno);
fd = 0;
goto done;
}
else
{
/* Give up now. */
fd = -1;
goto done;
}
}
continue;
default:
assert (! "invalid KIND in __gen_tempname");
}
if (fd >= 0)
{
__set_errno (save_errno);
goto done;
}
else if (errno != EEXIST)
{
fd = -1;
goto done;
}
}
randint_all_free (rand_src);
/* We got out of the loop because we ran out of combinations to try. */
__set_errno (EEXIST);
return -1;
done:
{
int saved_errno = errno;
randint_all_free (rand_src);
__set_errno (saved_errno);
}
return fd;
}
int
__gen_tempname (char *tmpl, int flags, int kind)
{
return gen_tempname_len (tmpl, flags, kind, 6);
}

View File

@@ -1,193 +0,0 @@
diff --git c/lib/tempname.c i/lib/tempname.c
index 2da5afe..562955a 100644
--- c/lib/tempname.c
+++ i/lib/tempname.c
@@ -22,6 +22,7 @@
#if !_LIBC
# include <config.h>
# include "tempname.h"
+# include "randint.h"
#endif
#include <sys/types.h>
@@ -49,6 +50,7 @@
# error report this to bug-gnulib@gnu.org
#endif
+#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
@@ -179,14 +181,21 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
}
#endif /* _LIBC */
+static inline bool
+check_x_suffix (char const *s, size_t len)
+{
+ return len <= strspn (s, "X");
+}
+
/* These are the characters used in temporary file names. */
static const char letters[] =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
/* Generate a temporary file name based on TMPL. TMPL must match the
- rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix).
+ rules for mk[s]temp (i.e. end in at least X_SUFFIX_LEN "X"s,
+ possibly with a suffix).
The name constructed does not exist at the time of the call to
- __gen_tempname. TMPL is overwritten with the result.
+ this function. TMPL is overwritten with the result.
KIND may be one of:
__GT_NOCREATE: simply verify that the name does not exist
@@ -197,23 +206,24 @@ static const char letters[] =
We use a clever algorithm to get hard-to-predict names. */
int
-__gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
+gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
+ size_t x_suffix_len)
{
- int len;
+ size_t len;
char *XXXXXX;
- static uint64_t value;
- uint64_t random_time_bits;
unsigned int count;
int fd = -1;
int save_errno = errno;
struct_stat64 st;
+ struct randint_source *rand_src;
/* A lower bound on the number of temporary files to attempt to
generate. The maximum total number of temporary file names that
can exist for a given template is 62**6. It should never be
necessary to try all these combinations. Instead if a reasonable
number of names is tried (we define reasonable as 62**3) fail to
- give the system administrator the chance to remove the problems. */
+ give the system administrator the chance to remove the problems.
+ This value requires that X_SUFFIX_LEN be at least 3. */
#define ATTEMPTS_MIN (62 * 62 * 62)
/* The number of times to attempt to generate a temporary file. To
@@ -225,43 +235,28 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
#endif
len = strlen (tmpl);
- if (len < 6 + suffixlen || memcmp (&tmpl[len - 6 - suffixlen], "XXXXXX", 6))
+ if (len < x_suffix_len + suffixlen
+ || ! check_x_suffix (&tmpl[len - x_suffix_len - suffixlen],
+ x_suffix_len))
{
__set_errno (EINVAL);
return -1;
}
/* This is where the Xs start. */
- XXXXXX = &tmpl[len - 6 - suffixlen];
+ XXXXXX = &tmpl[len - x_suffix_len - suffixlen];
/* Get some more or less random data. */
-#ifdef RANDOM_BITS
- RANDOM_BITS (random_time_bits);
-#else
- {
- struct timeval tv;
- __gettimeofday (&tv, NULL);
- random_time_bits = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec;
- }
-#endif
- value += random_time_bits ^ __getpid ();
+ rand_src = randint_all_new (NULL, 8);
+ if (! rand_src)
+ return -1;
- for (count = 0; count < attempts; value += 7777, ++count)
+ for (count = 0; count < attempts; ++count)
{
- uint64_t v = value;
-
- /* Fill in the random bits. */
- XXXXXX[0] = letters[v % 62];
- v /= 62;
- XXXXXX[1] = letters[v % 62];
- v /= 62;
- XXXXXX[2] = letters[v % 62];
- v /= 62;
- XXXXXX[3] = letters[v % 62];
- v /= 62;
- XXXXXX[4] = letters[v % 62];
- v /= 62;
- XXXXXX[5] = letters[v % 62];
+ size_t i;
+
+ for (i = 0; i < x_suffix_len; i++)
+ XXXXXX[i] = letters[randint_genmax (rand_src, sizeof letters - 2)];
switch (kind)
{
@@ -276,7 +271,7 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
break;
case __GT_NOCREATE:
- /* This case is backward from the other three. __gen_tempname
+ /* This case is backward from the other three. This function
succeeds if __xstat fails because the name does not exist.
Note the continue to bypass the common logic at the bottom
of the loop. */
@@ -285,11 +280,15 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
if (errno == ENOENT)
{
__set_errno (save_errno);
- return 0;
+ fd = 0;
+ goto done;
}
else
- /* Give up now. */
- return -1;
+ {
+ /* Give up now. */
+ fd = -1;
+ goto done;
+ }
}
continue;
@@ -301,13 +300,32 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
if (fd >= 0)
{
__set_errno (save_errno);
- return fd;
+ goto done;
}
else if (errno != EEXIST)
- return -1;
+ {
+ fd = -1;
+ goto done;
+ }
}
+ randint_all_free (rand_src);
+
/* We got out of the loop because we ran out of combinations to try. */
__set_errno (EEXIST);
return -1;
+
+ done:
+ {
+ int saved_errno = errno;
+ randint_all_free (rand_src);
+ __set_errno (saved_errno);
+ }
+ return fd;
+}
+
+int
+__gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
+{
+ return gen_tempname_len (tmpl, suffixlen, flags, kind, 6);
}

42
gl/lib/tempname.h Normal file
View File

@@ -0,0 +1,42 @@
/* Create a temporary file or directory.
Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* header written by Eric Blake */
/* In gnulib, always prefer large files. GT_FILE maps to
__GT_BIGFILE, not __GT_FILE, for a reason. */
#define GT_FILE 1
#define GT_DIR 2
#define GT_NOCREATE 3
/* Generate a temporary file name based on TMPL. TMPL must match the
rules for mk[s]temp (i.e. end in "XXXXXX"). The name constructed
does not exist at the time of the call to gen_tempname. TMPL is
overwritten with the result.
KIND may be one of:
GT_NOCREATE: simply verify that the name does not exist
at the time of the call.
GT_FILE: create a large file using open(O_CREAT|O_EXCL)
and return a read-write fd. The file is mode 0600.
GT_DIR: create a directory, which will be mode 0700.
We use a clever algorithm to get hard-to-predict names. */
#include <stddef.h>
extern int gen_tempname (char *tmpl, int flags, int kind);
extern int gen_tempname_len (char *tmpl, int flags, int kind,
size_t x_suffix_len);

View File

@@ -1,12 +0,0 @@
diff --git c/lib/tempname.h i/lib/tempname.h
index cd69e7d..9757db2 100644
--- c/lib/tempname.h
+++ i/lib/tempname.h
@@ -46,5 +46,7 @@
We use a clever algorithm to get hard-to-predict names. */
extern int gen_tempname (char *tmpl, int suffixlen, int flags, int kind);
+extern int gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
+ size_t x_suffix_len);
#endif /* GL_TEMPNAME_H */

41
gl/lib/xfreopen.c Normal file
View File

@@ -0,0 +1,41 @@
/* a wrapper for frepoen
Copyright (C) 2008-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include "xfreopen.h"
#include <errno.h>
#include "error.h"
#include "exitfail.h"
#include "quote.h"
#include "gettext.h"
#define _(msgid) gettext (msgid)
void
xfreopen (char const *filename, char const *mode, FILE *fp)
{
if (!freopen (filename, mode, fp))
{
char const *f = (filename ? filename
: (fp == stdin ? _("stdin")
: (fp == stdout ? _("stdout")
: (fp == stderr ? _("stderr")
: _("unknown stream")))));
error (exit_failure, errno, _("failed to reopen %s with mode %s"),
quote_n (0, f), quote_n (1, mode));
}
}

2
gl/lib/xfreopen.h Normal file
View File

@@ -0,0 +1,2 @@
#include <stdio.h>
void xfreopen (char const *filename, char const *mode, FILE *fp);

11
gl/m4/mgetgroups.m4 Normal file
View File

@@ -0,0 +1,11 @@
#serial 3
dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_MGETGROUPS],
[
AC_CHECK_FUNCS([getgrouplist])
AC_LIBOBJ([mgetgroups])
])

View File

@@ -1,5 +1,5 @@
#serial 3
dnl Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
dnl Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

View File

@@ -1,9 +0,0 @@
diff --git i/modules/link-tests w/modules/link-tests
index d8e7b1a..aca0e74 100644
--- i/modules/link-tests
+++ w/modules/link-tests
@@ -12,3 +12,4 @@ configure.ac:
Makefile.am:
TESTS += test-link
check_PROGRAMS += test-link
+test_link_LDADD = $(LDADD) @LIBINTL@

View File

@@ -1,11 +0,0 @@
Files:
tests/test-mbsalign.c
tests/macros.h
Depends-on:
configure.ac:
Makefile.am:
TESTS += test-mbsalign
check_PROGRAMS += test-mbsalign

24
gl/modules/mgetgroups Normal file
View File

@@ -0,0 +1,24 @@
Description:
Return the group IDs of a user in malloc'd storage.
Files:
lib/mgetgroups.c
lib/mgetgroups.h
m4/mgetgroups.m4
Depends-on:
getugroups
xalloc
configure.ac:
gl_MGETGROUPS
Makefile.am:
Include:
License:
LGPL
Maintainer:
Jim Meyering

View File

@@ -1,9 +0,0 @@
diff --git a/modules/rename-tests b/modules/rename-tests
index be1b423..fea330a 100644
--- a/modules/rename-tests
+++ b/modules/rename-tests
@@ -14,3 +14,4 @@ configure.ac:
Makefile.am:
TESTS += test-rename
check_PROGRAMS += test-rename
+test_rename_LDADD = $(LDADD) @LIBINTL@

25
gl/modules/xfreopen Normal file
View File

@@ -0,0 +1,25 @@
Description:
a wrapper for frepoen
Files:
lib/xfreopen.c
lib/xfreopen.h
Depends-on:
error
exitfail
quote
configure.ac:
Makefile.am:
lib_SOURCES += xfreopen.c xfreopen.h
Include:
"xfreopen.h"
License:
LGPL
Maintainer:
Jim Meyering

View File

@@ -1,100 +0,0 @@
/* Test that mbsalign works as advertised.
Copyright (C) 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Pádraig Brady. */
#include <config.h>
#include "mbsalign.h"
#include "macros.h"
#include <stdlib.h>
#include <locale.h>
int
main (void)
{
char dest[4 * 16 + 1];
size_t width, n;
/* Test unibyte truncation. */
width = 4;
n = mbsalign ("t\tés", dest, sizeof dest, &width, MBS_ALIGN_LEFT, 0);
ASSERT (n == 4);
/* Test center alignment. */
width = 4;
n = mbsalign ("es", dest, sizeof dest, &width, MBS_ALIGN_CENTER, 0);
ASSERT (*dest == ' ' && *(dest + n - 1) == ' ');
if (setlocale (LC_ALL, "en_US.UTF8"))
{
/* Check invalid input is flagged. */
width = 4;
n = mbsalign ("t\xe1\xe2s", dest, sizeof dest, &width, MBS_ALIGN_LEFT, 0);
ASSERT (n == (size_t) -1);
/* Check invalid input is treated as unibyte */
width = 4;
n = mbsalign ("t\xe1\xe2s", dest, sizeof dest, &width,
MBS_ALIGN_LEFT, MBA_UNIBYTE_FALLBACK);
ASSERT (n == 4);
/* Test multibyte center alignment. */
width = 4;
n = mbsalign ("és", dest, sizeof dest, &width, MBS_ALIGN_CENTER, 0);
ASSERT (*dest == ' ' && *(dest + n - 1) == ' ');
/* Test multibyte left alignment. */
width = 4;
n = mbsalign ("és", dest, sizeof dest, &width, MBS_ALIGN_LEFT, 0);
ASSERT (*(dest + n - 1) == ' ' && *(dest + n - 2) == ' ');
/* Test multibyte right alignment. */
width = 4;
n = mbsalign ("és", dest, sizeof dest, &width, MBS_ALIGN_RIGHT, 0);
ASSERT (*(dest) == ' ' && *(dest + 1) == ' ');
/* multibyte multicell truncation. */
width = 4; /* cells */
n = mbsalign ("日月火水", dest, sizeof dest, &width,
MBS_ALIGN_LEFT, 0);
ASSERT (n == 6); /* 2 characters */
/* multibyte unicell truncation. */
width = 3; /* cells */
n = mbsalign ("¹²³⁴", dest, sizeof dest, &width, MBS_ALIGN_LEFT, 0);
ASSERT (n == 6); /* 3 characters */
/* Check independence from dest buffer. */
width = 4; /* cells */
n = mbsalign ("¹²³⁴", dest, 0, &width, MBS_ALIGN_LEFT, 0);
ASSERT (n == 9); /* 4 characters */
/* Check that width is updated with cells required before padding. */
width = 4; /* cells */
n = mbsalign ("¹²³", dest, 0, &width, MBS_ALIGN_LEFT, 0);
ASSERT (width == 3);
/* Test case where output is larger than input
(as tab converted to multi byte replacement char). */
width = 4;
n = mbsalign ("t\tés" /* 6 including NUL */ , dest, sizeof dest,
&width, MBS_ALIGN_LEFT, 0);
ASSERT (n == 7);
}
return 0;
}

2
gnulib

Submodule gnulib updated: ef5acf2027...959d9cb463

View File

@@ -1,3 +1 @@
include gnulib.mk
AM_CFLAGS = $(GNULIB_WARN_CFLAGS) # $(WERROR_CFLAGS)

View File

@@ -8746,7 +8746,7 @@
-----
Copyright (C) 2000-2010 Free Software Foundation, Inc.
Copyright (C) 2000-2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

View File

@@ -1,6 +1,6 @@
## Makefile for gnulib/lib -*-Makefile-*-
# Copyright (C) 1995-2007, 2009-2010 Free Software Foundation, Inc.
# Copyright (C) 1995-2007, 2009 Free Software Foundation, Inc.
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
include gnulib.mk
AM_CFLAGS += $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS)
AM_CFLAGS += $(WARN_CFLAGS) # $(WERROR_CFLAGS)
libcoreutils_a_SOURCES += \
buffer-lcm.c buffer-lcm.h \

View File

@@ -1,6 +1,6 @@
/* buffer-lcm.c - compute a good buffer size for dealing with two files
Copyright (C) 2002, 2005, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2002, 2005, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -2,7 +2,7 @@
This function is probably useful only for choosing whether to issue
a prompt in an implementation of POSIX-specified rm.
Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -130,6 +130,6 @@ main (int argc, char **argv)
ok = euidaccess_stat (&st, mode);
printf ("%s: %s\n", file, ok ? "y" : "n");
return 0;
exit (0);
}
#endif

View File

@@ -1,6 +1,6 @@
/* Invoke open, but return either a desired file descriptor or -1.
Copyright (C) 2005-2006, 2008-2010 Free Software Foundation, Inc.
Copyright (C) 2005, 2006, 2008-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* Invoke open, but return either a desired file descriptor or -1.
Copyright (C) 2005, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2005, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* Locale-specific memory transformation
Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* Compare integer strings.
Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,7 +1,7 @@
/* Compare numeric strings. This is an internal include file.
Copyright (C) 1988, 1991-1993, 1995-1996, 1998-2000, 2003-2006, 2009-2010
Free Software Foundation, Inc.
Copyright (C) 1988, 1991, 1992, 1993, 1995, 1996, 1998, 1999, 2000,
2003, 2004, 2005, 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* Compare numeric strings.
Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Exercise chdir-long's sample main program.
# Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
# Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* xfts.c -- a wrapper for fts_open
Copyright (C) 2003, 2005-2007, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2003, 2005-2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,9 +21,13 @@
#include <stdbool.h>
#include <stdlib.h>
#include <errno.h>
#include <assert.h>
#include "error.h"
#include "gettext.h"
#define _(msgid) gettext (msgid)
#include "quote.h"
#include "xalloc.h"
#include "xfts.h"
@@ -36,30 +40,24 @@ xfts_open (char * const *argv, int options,
FTS *fts = fts_open (argv, options | FTS_CWDFD, compar);
if (fts == NULL)
{
/* This can fail in two ways: out of memory or with errno==EINVAL,
which indicates it was called with invalid bit_flags. */
assert (errno != EINVAL);
xalloc_die ();
/* This can fail in three ways: out of memory, invalid bit_flags,
and one or more of the FILES is an empty string. We could try
to decipher that errno==EINVAL means invalid bit_flags and
errno==ENOENT means there's an empty string, but that seems wrong.
Ideally, fts_open would return a proper error indicator. For now,
we'll presume that the bit_flags are valid and just check for
empty strings. */
bool invalid_arg = false;
for (; *argv; ++argv)
{
if (**argv == '\0')
invalid_arg = true;
}
if (invalid_arg)
error (EXIT_FAILURE, 0, _("invalid argument: %s"), quote (""));
else
xalloc_die ();
}
return fts;
}
/* When fts_read returns FTS_DC to indicate a directory cycle,
it may or may not indicate a real problem. When a program like
chgrp performs a recursive traversal that requires traversing
symbolic links, it is *not* a problem. However, when invoked
with "-P -R", it deserves a warning. The fts_options member
records the options that control this aspect of fts's behavior,
so test that. */
bool
cycle_warning_required (FTS const *fts, FTSENT const *ent)
{
#define ISSET(Fts,Opt) ((Fts)->fts_options & (Opt))
/* When dereferencing no symlinks, or when dereferencing only
those listed on the command line and we're not processing
a command-line argument, then a cycle is a serious problem. */
return ((ISSET (fts, FTS_PHYSICAL) && !ISSET (fts, FTS_COMFOLLOW))
|| (ISSET (fts, FTS_PHYSICAL) && ISSET (fts, FTS_COMFOLLOW)
&& ent->fts_level != FTS_ROOTLEVEL));
}

View File

@@ -1,9 +1,5 @@
#include <stdbool.h>
#include "fts_.h"
FTS *
xfts_open (char * const *, int options,
int (*) (const FTSENT **, const FTSENT **));
bool
cycle_warning_required (FTS const *fts, FTSENT const *ent);

View File

@@ -1,6 +1,6 @@
/* Locale-specific memory transformation
Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 2006, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -5004,7 +5004,8 @@
-----
Copyright (C) 1997-2006, 2009-2010 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice

View File

@@ -1,8 +1,7 @@
# boottime.m4 serial 4
# Determine whether this system has infrastructure for obtaining the boot time.
# Copyright (C) 1996, 2000, 2002-2004, 2006, 2008-2010 Free Software
# Foundation, Inc.
# Copyright (C) 1996, 2000, 2002-2004, 2006, 2008-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@@ -1,8 +1,8 @@
#serial 26
#serial 25
# Check declarations for this package.
dnl Copyright (C) 1997-2001, 2003-2006, 2008-2010 Free Software Foundation,
dnl Inc.
dnl Copyright (C) 1997-2001, 2003-2006, 2008-2009 Free Software
dnl Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -35,6 +35,8 @@ AC_DEFUN([gl_CHECK_DECLS],
getpwuid,
ttyname], , , $headers)
AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>])
AC_CHECK_DECLS_ONCE([geteuid])
AC_CHECK_DECLS_ONCE([getlogin])
AC_CHECK_DECLS_ONCE([getuid])

View File

@@ -1,5 +1,5 @@
# serial 1
dnl Copyright (C) 2005, 2009-2010 Free Software Foundation, Inc.
dnl Copyright (C) 2005, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

View File

@@ -1,6 +1,6 @@
# Invoke open, but return either a desired file descriptor or -1.
dnl Copyright (C) 2005, 2009-2010 Free Software Foundation, Inc.
dnl Copyright (C) 2005, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,

View File

@@ -1,6 +1,6 @@
# Tests for GNU GMP (or any compatible replacement).
dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
dnl Copyright (C) 2008-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -30,9 +30,7 @@ AC_DEFUN([cu_GMP],
LIB_GMP=$ac_cv_search___gmpz_init
AC_DEFINE([HAVE_GMP], [1],
[Define if you have GNU libgmp (or replacement)])
}],
[AC_MSG_WARN([libgmp development library was not found or not usable.])
AC_MSG_WARN([AC_PACKAGE_NAME will be built without GMP support.])])
}])
LIBS=$cu_saved_libs
fi
])

View File

@@ -1,5 +1,5 @@
#serial 2
dnl Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc.
dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

View File

@@ -2,7 +2,7 @@
dnl Misc type-related macros for coreutils.
# Copyright (C) 1998, 2000-2010 Free Software Foundation, Inc.
# Copyright (C) 1998, 2000-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,8 +35,8 @@ AC_DEFUN([coreutils_MACROS],
AC_REQUIRE([AC_FUNC_FSEEKO])
# By default, argmatch should fail calling usage (EXIT_FAILURE).
AC_DEFINE([ARGMATCH_DIE], [usage (EXIT_FAILURE)],
# By default, argmatch should fail calling usage (1).
AC_DEFINE([ARGMATCH_DIE], [usage (1)],
[Define to the function xargmatch calls on failures.])
AC_DEFINE([ARGMATCH_DIE_DECL], [void usage (int _e)],
[Define to the declaration of the xargmatch failure function.])
@@ -64,7 +64,6 @@ AC_DEFUN([coreutils_MACROS],
LIBS=$coreutils_saved_libs
# Used by sort.c.
AC_CHECK_FUNCS_ONCE([posix_fadvise])
AC_CHECK_FUNCS_ONCE([nl_langinfo])
# Used by tail.c.
@@ -95,7 +94,6 @@ AC_DEFUN([coreutils_MACROS],
# for dd.c and shred.c
coreutils_saved_libs=$LIBS
LIB_FDATASYNC=
AC_SEARCH_LIBS([fdatasync], [rt posix4],
[test "$ac_cv_search_fdatasync" = "none required" ||
LIB_FDATASYNC=$ac_cv_search_fdatasync])
@@ -117,8 +115,7 @@ AC_DEFUN([coreutils_MACROS],
if test "X$enable_libcap" = "Xyes"; then
AC_MSG_ERROR([libcap library was not found or not usable])
else
AC_MSG_WARN([libcap library was not found or not usable.])
AC_MSG_WARN([AC_PACKAGE_NAME will be built without capability support.])
AC_MSG_WARN([libcap library was not found or not usable, support for libcap will not be built])
fi
fi
else
@@ -145,25 +142,6 @@ AC_DEFUN([coreutils_MACROS],
])
AC_REQUIRE([AM_LANGINFO_CODESET])
# Accept configure options: --with-tty-group[=GROUP], --without-tty-group
# You can determine the group of a TTY via 'stat --format %G /dev/tty'
# Omitting this option is equivalent to using --without-tty-group.
AC_ARG_WITH([tty-group],
AS_HELP_STRING([--with-tty-group[[[=NAME]]]],
[group used by system for TTYs, "tty" when not specified]
[ (default: do not rely on any group used for TTYs)]),
[tty_group_name=$withval],
[tty_group_name=no])
if test "x$tty_group_name" != xno; then
if test "x$tty_group_name" = xyes; then
tty_group_name=tty
fi
AC_MSG_NOTICE([TTY group used by system set to "$tty_group_name"])
AC_DEFINE_UNQUOTED([TTY_GROUP_NAME], ["$tty_group_name"],
[group used by system for TTYs])
fi
])
AC_DEFUN([gl_CHECK_ALL_HEADERS],
@@ -173,9 +151,12 @@ AC_DEFUN([gl_CHECK_ALL_HEADERS],
paths.h \
priv.h \
stropts.h \
sys/ioctl.h \
sys/param.h \
sys/resource.h \
sys/systeminfo.h \
sys/time.h \
sys/wait.h \
syslog.h \
termios.h \
)
@@ -189,6 +170,11 @@ AC_DEFUN([gl_CHECK_ALL_HEADERS],
# This macro must be invoked before any tests that run the compiler.
AC_DEFUN([gl_CHECK_ALL_TYPES],
[
dnl This test must come as early as possible after the compiler configuration
dnl tests, because the choice of the file model can (in principle) affect
dnl whether functions and headers are available, whether they work, etc.
AC_REQUIRE([AC_SYS_LARGEFILE])
dnl This test must precede tests of compiler characteristics like
dnl that for the inline keyword, since it may change the degree to
dnl which the compiler supports such features.

View File

@@ -2,8 +2,8 @@
dnl Misc lib-related macros for coreutils.
# Copyright (C) 1993-1997, 2000-2001, 2003-2006, 2008-2010 Free Software
# Foundation, Inc.
# Copyright (C) 1993-1997, 2000-2001, 2003-2006, 2008-2009
# Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -51,7 +51,6 @@ $ac_includes_default
# SCO-ODT-3.0 is reported to need -lufc for crypt.
# NetBSD needs -lcrypt for crypt.
LIB_CRYPT=
cu_saved_libs="$LIBS"
AC_SEARCH_LIBS([crypt], [ufc crypt],
[test "$ac_cv_search_crypt" = "none required" ||

View File

@@ -1,4 +1,4 @@
dnl Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
dnl Copyright (C) 2006, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

View File

@@ -7,7 +7,7 @@ m4_pattern_forbid([^gl_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
# directory of the coreutils package.
# Copyright (C) 1998, 2000-2001, 2003-2010 Free Software Foundation, Inc.
# Copyright (C) 1998, 2000, 2001, 2003-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@@ -1,7 +1,7 @@
# stat-prog.m4 serial 6
# Record the prerequisites of src/stat.c from the coreutils package.
# Copyright (C) 2002-2004, 2006, 2008-2010 Free Software Foundation, Inc.
# Copyright (C) 2002-2004, 2006, 2008-2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
# Compare numeric strings.
dnl Copyright (C) 2005, 2009-2010 Free Software Foundation, Inc.
dnl Copyright (C) 2005, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,

View File

@@ -1,7 +1,6 @@
# xattr.m4 - check for Extended Attributes (Linux)
# serial 3
# Copyright (C) 2003, 2008-2010 Free Software Foundation, Inc.
# Copyright (C) 2003, 2008-2009 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,29 +15,22 @@ AC_DEFUN([gl_FUNC_XATTR],
[do not support extended attributes]),
[use_xattr=$enableval], [use_xattr=yes])
LIB_XATTR=
AC_SUBST([LIB_XATTR])
if test "$use_xattr" = "yes"; then
AC_CHECK_HEADERS([attr/error_context.h attr/libattr.h])
use_xattr=no
if test $ac_cv_header_attr_libattr_h = yes \
&& test $ac_cv_header_attr_error_context_h = yes; then
xattr_saved_LIBS=$LIBS
AC_SEARCH_LIBS([attr_copy_file], [attr],
[test "$ac_cv_search_attr_copy_file" = "none required" ||
LIB_XATTR=$ac_cv_search_attr_copy_file])
AC_CHECK_FUNCS([attr_copy_file])
LIBS=$xattr_saved_LIBS
if test $ac_cv_func_attr_copy_file = yes; then
use_xattr=yes
fi
fi
if test $use_xattr = no; then
AC_MSG_WARN([libattr development library was not found or not usable.])
AC_MSG_WARN([AC_PACKAGE_NAME will be built without xattr support.])
&& test $ac_cv_header_attr_error_context_h = yes; then
use_xattr=1
else
use_xattr=0
fi
AC_DEFINE_UNQUOTED([USE_XATTR], [$use_xattr],
[Define if you want extended attribute support.])
xattr_saved_LIBS=$LIBS
AC_SEARCH_LIBS([attr_copy_file], [attr],
[test "$ac_cv_search_attr_copy_file" = "none required" ||
LIB_XATTR=$ac_cv_search_attr_copy_file])
AC_CHECK_FUNCS([attr_copy_file])
LIBS=$xattr_saved_LIBS
AC_SUBST([LIB_XATTR])
fi
AC_DEFINE_UNQUOTED([USE_XATTR], [`test $use_xattr != yes; echo $?`],
[Define if you want extended attribute support.])
])

View File

@@ -1,5 +1,5 @@
#serial 1
dnl Copyright (C) 2005, 2009-2010 Free Software Foundation, Inc.
dnl Copyright (C) 2005, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

Some files were not shown because too many files have changed in this diff Show More