Age | Commit message (Collapse) | Author |
|
* src/ls.c (gobble_file): Much like the 2007-04-07 fix,
add a term to the expression that decides whether we need
stat and/or lstat calls. Reported by Andreas Frische.
|
|
* src/ls.c (gobble_file): Form and compute length of strings for
block size, owner, group, author, major+minor numbers and file size
only if they'll actually be used. I.e., don't form most of them
when not producing long format output.
|
|
* src/ls.c (gobble_file): Use "stat" (not lstat) also when the
ln=target attribute applies. Reported by Kirk Kelsey.
|
|
ls -x DIR would sometimes output the wrong string in place of the
first entry.
* NEWS: Mention the bug fix.
* tests/ls/x-option: New file.
* tests/ls/Makefile.am (TESTS): Add x-option.
|
|
Upon failed getfilecon, accept not just ENOTSUP, but also ENODATA.
|
|
I started with the patches from Red Hat.
The entries below tell how the code evolved.
* src/ls.c (print_long_format, print_file_name_and_frills): When
there is no security context (due to getfilecon/lgetfilecon failing
with e.g. ENOTSUP), print it as "?", not "".
* src/ls.c (print_file_name_and_frills): Make -Z work without -l.
(length_of_file_name_and_frills): Likewise.
* src/ls.c: Remove the --lcontext and --scontext options.
Change the way -Z, --context work so that it no longer implies -l.
Thus, -Z -l will work like -lcontext and -Z without -l will work
like --scontext.
Adjust tests to reflect new 'ls -l' syntax -- affects only
systems with SELinux when operating on a file with no ACL.
These tests assumed that everything before the first space on
each line is the 10-byte mode string. But there may also be a "+"
in the 11th column, just before the space. However, note that this
is not new. The same thing would have happened even without the
change below, when listing a file with an ACL.
* tests/chmod/equals, tests/cp/cp-parents, tests/cp/fail-perm:
* tests/cp/link-preserve, tests/install/basic-1, tests/misc/mknod:
* tests/mkdir/parents, tests/mkdir/special-1, tests/mv/partition-perm:
Don't make compilation depend on USE_ACL. An SELinux security
context counts as an "alternate access control method", so ls
must output a "+" for each file with a security context.
* src/ls.c [struct fileinfo] (have_acl): Declare unconditionally.
(FILE_HAS_ACL): Remove macro definition. Use f->have_acl directly.
(gobble_file): Record whether a file has a security context, and
update the condition used to determine whether to print the "+".
(gobble_file): Call getfilecon/lgetfilecon also when
format == long_format, so that we get the "+".
* src/ls.c (gobble_file): Add a comment explaining why (with a
security context option) ls doesn't exit nonzero due to e.g.,
getfilecon failing with errno == ENOTSUP.
* src/ls.c (gobble_file): Ignore failure of getfilecon if it's due
to ENOTSUP.
* src/ls.c (gobble_file): Factor out three small blocks using
getfilecon and lgetfilecon.
Don't ignore return value from getfilecon and lgetfilecon.
* src/ls.c (print_long_format): Don't use ?: (empty 2nd arg with C
ternary operator).
(print_scontext_format): Likewise.
(print_scontext): Declare to be "bool", not int. Adjust uses.
* src/Makefile.am (dir_LDADD, ls_LDADD, vdir_LDADD): Add $(LIB_SELINUX).
* tests/misc/chcon: New file.
* tests/misc/chcon-fail: New file.
* tests/Makefile.am (check-root): Run new, root-only misc/chcon test.
* tests/misc/Makefile.am (TESTS): Add chcon and chcon-fail.
* tests/misc/Makefile.am (TESTS): Add selinux.
* tests/misc/selinux: New file.
* tests/help-version: Skip chcon.
|
|
* src/system.h (emit_bug_reporting_address): New function.
* src/base64.c: Use it rather than a literal printf.
* src/basename.c, src/cat.c, src/chgrp.c, src/chmod.c:
* src/chown.c, src/chroot.c, src/cksum.c, src/comm.c, src/cp.c:
* src/csplit.c, src/cut.c, src/date.c, src/dd.c, src/df.c:
* src/dircolors.c, src/dirname.c, src/du.c, src/echo.c, src/env.c:
* src/expand.c, src/expr.c, src/factor.c, src/fmt.c, src/fold.c:
* src/head.c, src/hostid.c, src/hostname.c, src/id.c, src/install.c:
* src/join.c, src/kill.c, src/link.c, src/ln.c, src/logname.c:
* src/ls.c, src/md5sum.c, src/mkdir.c, src/mkfifo.c, src/mknod.c:
* src/mv.c, src/nice.c, src/nl.c, src/nohup.c, src/od.c:
* src/paste.c, src/pathchk.c, src/pinky.c, src/pr.c, src/printenv.c:
* src/printf.c, src/ptx.c, src/pwd.c, src/readlink.c, src/rm.c:
* src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c, src/shuf.c:
* src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c:
* src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac.c:
* src/tail.c, src/tee.c, src/test.c, src/touch.c, src/tr.c:
* src/true.c, src/tsort.c, src/tty.c, src/uname.c, src/unexpand.c:
* src/uniq.c, src/unlink.c, src/uptime.c, src/users.c, src/wc.c:
* src/who.c, src/whoami.c, src/yes.c: Likewise.
|
|
xreadlink-with-size. Add xreadlink.
* src/copy.c (copy_internal): Update.
* src/ls.c (is_directory): Update.
* src/stat.c (print_stat): Update.
* src/readlink.c (main): Use the one-argument xreadlink function.
|
|
each option string from its description, so help2man formats
the derived man page properly. Reported by Thomas Huriaux in
<http://bugs.debian.org/410407>.
* src/df.c (usage): Likewise.
* src/du.c (usage): Likewise.
* src/install.c (usage): Likewise.
* src/ls.c (usage): Likewise.
|
|
* src/ls.c (print_dir): Don't leak a "DIR"+fd upon failure to
determine dev/inode or upon detecting a symlink loop.
|
|
(cwd_file): Rename from 'files'.
(cwd_n_alloc): Rename from 'nfiles'.
(cwd_n_used): Rename from 'files_index'.
|
|
* src/ls.c (fileinfo): Put all members of type "bool" together.
|
|
module rather than qsort. This is particularly a win in
environments where strcoll is slow, since mpsort typically calls
strcoll less often than qsort does.
* bootstrap.conf (gnulib_modules): Add mpsort.
* src/ls.c: Include mpsort.h.
(sorted_file, sorted_file_alloc): New vars, for a new vector of
pointers to the file info, for speed.
(clear_files, extract_dirs_from_files, sort_files, print_current_files):
(print_many_per_line, print_horizontal, print_with_commas):
(calculate_columns): Set and use new vector.
(initialize_ordering_vector): New function.
|
|
* src/csplit.c (main): Also catch SIGALRM, SIGPIPE, SIGPOLL,
SIGPROF, SIGVTALRM, SIGXCPU, SIGXFSZ.
* src/ls.c (main): Likewise (except SIGPIPE was already caught).
Note that ls.c is special, as it also catches SIGTSTP.
* src/sort.c (main): Likewise. Also catch SIGQUIT. More details in
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/9510>.
|
|
* NEWS: Mention this bug fix.
* src/ls.c (gobble_file): Fix bug reported by
Nobuyuki Tsuchimura in
http://lists.gnu.org/archive/html/bug-coreutils/2006-12/msg00152.html
where "ls -FRL" didn't follow a symbolic link in some cases on Linux.
* tests/ls/follow-slink: Add a test for this case.
Signed-off-by: Jim Meyering <jim@meyering.net>
|
|
I found.
* Makefile.maint (my-distcheck): Also check for C89 compatibility
as best we can with GCC.
* src/stat.c (PRINTF_OPTION): Omit comma before } in enum
declaration; C89 doesn't allow this.
* src/dcgen: Don't generate string literals longer than
what C89 requires support for.
* src/cut.c (usage): Don't use string literals longer than
what C89 requires support for.
* src/date.c (usage): Likewise.
* src/dd.c (usage): Likewise.
* src/du.c (usage): Likewise.
* src/ls.c (usage): Likewise.
* src/od.c (usage): Likewise.
* src/readlink.c (usage): Likewise.
* src/seq.c (usage): Likewise.
* src/shred.c (usage): Likewise.
|
|
* lib/.cvsignore, lib/.gitignore: Add root-dev-ino.c, root-dev-ino.h.
* m4/.cvsignore, m4/.gitignore: Add root-dev-ino.m4.
* src/ls.c (DIRED_FPUTS_LITERAL, PUSH_CURRENT_DIRED_POS):
Omit unnecessary parenthesization of args.
* src/od.c (EQUAL_BLOCKS): Likewise.
* src/system.h (STREQ, ASSIGN_STRDUPA): Likewise.
|
|
It works even without -l. Suggestion from Karl Berry.
|
|
initialize an object to zero. This is easier to read and is less
likely to introduce an runtime error due to a mixup. It causes
gcc -W to issue a warning, but you can work around this by
appending -Wno-missing-field-initializers.
* src/pathchk.c (portable_chars_only): Likewise.
* src/shred.c (main): Likewise.
* src/stty.c (main): Likewise.
* src/tr.c (card_of_complement): Likewise.
* src/wc.c (wc): Likewise.
|
|
|
|
S_ISLNK are defined, since they're always defined now.
* src/cp.c (main): Likewise.
* src/ln.c (main): Likewise.
* src/ls.c (get_link_name, make_link_name): Likewise.
* src/mkfifo.c (usage): Likewise.
* src/who.c (S_IWGRP): Likewise.
|
|
(dot_or_dotdot): ...new static inline function.
* src/remove.c (rm_1): Reflect this renaming.
* src/ls.c (basename_is_dot_or_dotdot): Likewise.
|
|
no differently than regular directories on a file system with
dirent.d_type support.
* NEWS: Say the above.
* src/ls.c (gobble_file): With --color, also stat the file when
we know it is a directory.
Derived from an anonymous one-line fix and bug report:
<https://savannah.gnu.org/bugs/?15043>.
* tests/ls/color-dtype-dir: New file. Test for the above fix.
* tests/ls/Makefile.am (TESTS): Add color-dtype-dir.
|
|
|
|
files and we bootstrap the rest from gnulib, gettext, etc.
* README-cvs: New file.
* bootstrap: New file.
* bootstrap.conf: New file.
* .x-sc_trailing_blank: Remove config-log, .gdb-history. Add .po.
* configure.ac (AC_PREREQ): Move here from m4/*.m4, for benefit
of gnulib-tool.
(gl_DEFAULT_POSIX2_VERSION, gl_USE_SYSTEM_EXTENSIONS, gl_PERL):
(gl_IGNORE_UNUSED_LIBRARIES): Remove; now done by gnulib.
(gl_EARLY): Add.
(gl_MACROS): Call just after gl_EARLY, just for clarity.
* src/c99-to-c98.diff: Remove patch to ls.c; no longer needed.
* src/kill.c (strtoimax): Remove decl.
* src/ls.c: Include "wcwidth.h" instead of rolling it ourselves.
* src/wc.c: Likewise.
* src/ls.c (sort_files): Rewrite to avoid need for C99-style
declaration, so that we don't need to patch this file.
* src/printf.c (strtoimax, strtoumax): Remove decls.
* src/su.c: Include getpass.h.
(getpass): remove.
* src/system.h: Include mempcpy.h, stpcpy.h, strpbrk.h.
Include inttypes.h unconditionally; remove decls it handles.
* lib/Makefile.am: include gnulib.mk, so that we can remove most of
this file.
(AM_CPPFLAGS): Don't mention -I$(srcdir), since that's now done
for us.
(noinst_LIBRARIES, LDDADD, DEFS): Remove.
(libcoreutils_a_SOURCES): Trim down greatly, just to the files
that aren't in gnulib.
Remove defns gnulib does for us.
* m4/check-decl.m4 (gl_CHECK_DECLS):
Don't include stdio.h, string.h, stdlib.h, unistd.h, sys/time.h,
time.h. Use AC_CHECK_DECLS_ONCE for free, getenv, geteuid, getlogin,
getuid, lseek, malloc, memchr, realloc. Don't check for getutent,
memrchr, nanosleep, stpcpy, strndup, strnlen, strstr, strtoul,
strtoull.
(_gl_DECL_HEADERS): Remove; all uses removed.
* m4/jm-macros.m4 (gl_MACROS): Move AC_PREREQ into configure.ac
for the benefit of gnulib-tool. Call gl_INIT.
Do not call or require macros that gnulib will handle for us.
Don't check for fchmod, hasmntopt, isascii, lchown, listmntent,
mempcpy, realpath, wcrtomb, tzset.
(gl_CHECK_ALL_HEADERS): Don't check for sys/statvfs.h, sys/vfs.h,
sys/mount.h.
(gl_CHECK_ALL_TYPES): Require AC_TYPE_UNSIGNED_LONG_LONG_INT.
Don't check for struct stat.st_blksize.
Don't require AC_STRUCT_ST_DM_MODE, gt_TYPE_SSIZE_T,
gl_AC_TYPE_UINT32_T, gl_AC_TYPE_UINTMAX_T, gl_AC_TYPE_UINTPTR_T,
gl_AC_TYPE_UNSIGNED_LONG_LONG.
* m4/prereq.m4 (gl_PREREQ): Require gl_FUNC_XFTS, gl_ROOT_DEV_INO.
Don't require macros that gnulib does for us.
* m4/stat-prog.m4 (cu_PREREQ_STAT_PROG): Don't check for
sys/sysmacros.h. Don't check for statvfs. Use AC_CHECK_HEADERS_ONCE
for netinet/in.h, nfs/nfs_clnt.h, nfs/vfs.h.
Don't require gl_AC_TYPE_LONG_LONG, gt_HEADER_INTTYPES_H.
|
|
* src/ls.c (get_type_indicator): New function. extracted from...
(print_type_indicator): ...here. Use it.
(length_of_file_name_and_frills): Use it here, too, rather than
assuming stat.st_mode is valid.
Reported by Andreas Schwab, here:
<http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/7774>
FIXME: add a test for this: FYI, I did ls -CF /proc and visually
inspected the result.
|
|
and filetype_letter have the same number of elements.
|
|
than having the code test for all of the other types first.
Hoist the set-uid/gid-testing code "up" into this new block.
Classify any other type of file (e.g., S_TYPEISSHM, etc.) as
C_ORPHAN, not as C_FILE.
* doc/coreutils.texi (What information is listed): Mention that missing
pieces of information are marked with "?". From Paul Eggert.
|
|
2006-07-25 Paul Eggert <eggert@cs.ucla.edu>
* src/ls.c (DT_INIT): Remove. All uses removed.
(enum filetype): Use an ordinary enum rather than trying to keep
the values in sync with DT_FIFO etc. That way, we don't have
to make special assumptions about them. All uses changed.
(whiteout): New constant member of enum filetype.
(filetype_letter): New constant, for use with enum filetype.
(FILETYPE_INDICATORS): New initializer list.
(print_dir): Add case for DT_WHT.
(gobble_file): If stat fails, don't discard information from
readdir; instead, preserve it so it can be printed.
(print_long_format): Fall back on readdir result if stat info
is not available. Use "?" to denote each unknown mode char,
instead of an overall "?", since we now know some of the mode
typically.
(print_type_indicator): Now that MODE isn't necessarily
useful, guard all uses.
Now that two blocks in the type-checking tree can set "type = C_FILE",
move the suffix-handling code out and down.
|
|
* src/ls.c [struct fileinfo] (stat_ok): Rename from stat_failed,
and adjust uses. From a patch by Paul Eggert.
|
|
|
|
print the entry name not the absolute_name -- to be consistent
with the usual case.
* tests/ls/stat-failed: Update accordingly.
|
|
|
|
* src/ls.c (print_long_format): Be careful to increment P by the
appropriate amount, even when inode_number_width and nlink_width
are zero.
* tests/ls/stat-failed: Test for the above.
|
|
have_acl member. That would happen for a directory with both a
non-stat'able entry and one with an ACL.
|
|
non-command-line file provokes an exit status of 1, not 0.
Say "cannot access" rather than "cannot stat".
* tests/ls/stat-failed: New file/test, for the above.
* tests/ls/Makefile.am (TESTS): Add stat-failed.
|
|
|
|
Replace all occurrences of "type == command_line" with the
equivalent, "command_line_arg".
|
|
coreutils-selinux.patch. From Ulrich Drepper.
This makes it so files not mentioned on the command line (e.g.,
names read from a directory that *is* mentioned on the command
line) for which stat fails are still listed. With --color,
such files are colored just like ORPHANs (aka dangling symlinks).
|
|
alphabetized.
|
|
stat for a symlink, even though it wasn't always needed.
In some cases, that unnecessary stat would cause ls to fail.
* src/ls.c (gobble_file): Don't treat symlinks specially (in
requiring a stat syscall). Remove the offending exclusion.
* NEWS: Mention the fix.
* tests/ls/stat-dtype: New file/test, for the above fix.
Also exercises the new df feature, below.
|
|
rather than like --indicator-style=file-type.
(FILE_TYPE_INDICATOR_OPTION): New enum member.
(long_options): Map "file-type" to FILE_TYPE_INDICATOR_OPTION,
not to 'p'.
(decode_switches): Handle new case: FILE_TYPE_INDICATOR_OPTION.
|
|
|
|
|
|
only in a long listing. Reported by Martin Pool in
<https://launchpad.net/distros/ubuntu/+source/coreutils/+bug/51653>.
|
|
|
|
From Justin Pryzby.
|
|
|
|
Use better macro parameter names: s/basename/key_name/,
s/basefunc/key_cmp_func. Fix typo in comment.
|
|
implies format_needs_type, not format_needs_stat.
|