summaryrefslogtreecommitdiffstats
path: root/bin/ls
Commit message (Collapse)AuthorAgeFilesLines
* MFC r291919:ngie2015-12-101-6/+0
| | | | | | | | | | | Enable bin/ls testcases disabled previously because of issues with how kyua 0.11's version of report-junit was rendering non-printable characters Upgrade to kyua 0.12 to obtain a fixed version of the command Output verified with python 2.7.10's xml.dom.minidom module Sponsored by: EMC / Isilon Storage Division
* MFC r288330,r288423,r288678,r288905,r288906,r288907,r289102:ngie2015-10-253-0/+979
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r288330: Add initial testcases for bin/ls Sponsored by: EMC / Isilon Storage Division r288423: Skip the B_flag testcase to stop blowing up freebsd-current@ with "test failure emails" because kyua report-jenkins doesn't properly escape non-printable chars r288678: Merge additional testcases and improvements to bin/ls/ls_tests from ^/user/ngie/more-tests. - Additional testcases added: -- ls -D -- ls -F -- ls -H -- ls -L -- ls -R -- ls -S -- ls -T -- ls -b -- ls -d -- ls -f -- ls -g -- ls -h -- ls -i -- ls -k -- ls -l -- ls -m -- ls -n -- ls -o -- ls -p -- ls -q/ls -w -- ls -r -- ls -s -- ls -t -- ls -u -- ls -y - Socket file creation is limited to the ls -F testcase, greatly speeding up the test process - The ls -C testcase was made more robust by limiting the number of columns via COLUMNS and by dynamically formulating the columns/lines. - Add `atf_test_case` before all testcase `head` functions. Sponsored by: EMC / Isilon Storage Division r288905: Add some more syncs to quiesce the filesystem after creating the files to see if this fixes deterministic Jenkin failures r288906: Explicitly set BLOCKSIZE to 512 in the environment r288907: Call sync consistently using atf_check Remove superfluous sync's r289102: Remove all of the syncs They're unnecessary as shown by further testing on my VM Requested by: jhb
* Expand the use of stat(2) flags to allow storing some Windows/DOSken2013-08-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and CIFS file attributes as BSD stat(2) flags. This work is intended to be compatible with ZFS, the Solaris CIFS server's interaction with ZFS, somewhat compatible with MacOS X, and of course compatible with Windows. The Windows attributes that are implemented were chosen based on the attributes that ZFS already supports. The summary of the flags is as follows: UF_SYSTEM: Command line name: "system" or "usystem" ZFS name: XAT_SYSTEM, ZFS_SYSTEM Windows: FILE_ATTRIBUTE_SYSTEM This flag means that the file is used by the operating system. FreeBSD does not enforce any special handling when this flag is set. UF_SPARSE: Command line name: "sparse" or "usparse" ZFS name: XAT_SPARSE, ZFS_SPARSE Windows: FILE_ATTRIBUTE_SPARSE_FILE This flag means that the file is sparse. Although ZFS may modify this in some situations, there is not generally any special handling for this flag. UF_OFFLINE: Command line name: "offline" or "uoffline" ZFS name: XAT_OFFLINE, ZFS_OFFLINE Windows: FILE_ATTRIBUTE_OFFLINE This flag means that the file has been moved to offline storage. FreeBSD does not have any special handling for this flag. UF_REPARSE: Command line name: "reparse" or "ureparse" ZFS name: XAT_REPARSE, ZFS_REPARSE Windows: FILE_ATTRIBUTE_REPARSE_POINT This flag means that the file is a Windows reparse point. ZFS has special handling code for reparse points, but we don't currently have the other supporting infrastructure for them. UF_HIDDEN: Command line name: "hidden" or "uhidden" ZFS name: XAT_HIDDEN, ZFS_HIDDEN Windows: FILE_ATTRIBUTE_HIDDEN This flag means that the file may be excluded from a directory listing if the application honors it. FreeBSD has no special handling for this flag. The name and bit definition for UF_HIDDEN are identical to the definition in MacOS X. UF_READONLY: Command line name: "urdonly", "rdonly", "readonly" ZFS name: XAT_READONLY, ZFS_READONLY Windows: FILE_ATTRIBUTE_READONLY This flag means that the file may not written or appended, but its attributes may be changed. ZFS currently enforces this flag, but Illumos developers have discussed disabling enforcement. The behavior of this flag is different than MacOS X. MacOS X uses UF_IMMUTABLE to represent the DOS readonly permission, but that flag has a stronger meaning than the semantics of DOS readonly permissions. UF_ARCHIVE: Command line name: "uarch", "uarchive" ZFS_NAME: XAT_ARCHIVE, ZFS_ARCHIVE Windows name: FILE_ATTRIBUTE_ARCHIVE The UF_ARCHIVED flag means that the file has changed and needs to be archived. The meaning is same as the Windows FILE_ATTRIBUTE_ARCHIVE attribute, and the ZFS XAT_ARCHIVE and ZFS_ARCHIVE attribute. msdosfs and ZFS have special handling for this flag. i.e. they will set it when the file changes. sys/param.h: Bump __FreeBSD_version to 1000047 for the addition of new stat(2) flags. chflags.1: Document the new command line flag names (e.g. "system", "hidden") available to the user. ls.1: Reference chflags(1) for a list of file flags and their meanings. strtofflags.c: Implement the mapping between the new command line flag names and new stat(2) flags. chflags.2: Document all of the new stat(2) flags, and explain the intended behavior in a little more detail. Explain how they map to Windows file attributes. Different filesystems behave differently with respect to flags, so warn the application developer to take care when using them. zfs_vnops.c: Add support for getting and setting the UF_ARCHIVE, UF_READONLY, UF_SYSTEM, UF_HIDDEN, UF_REPARSE, UF_OFFLINE, and UF_SPARSE flags. All of these flags are implemented using attributes that ZFS already supports, so the on-disk format has not changed. ZFS currently doesn't allow setting the UF_REPARSE flag, and we don't really have the other infrastructure to support reparse points. msdosfs_denode.c, msdosfs_vnops.c: Add support for getting and setting UF_HIDDEN, UF_SYSTEM and UF_READONLY in MSDOSFS. It supported SF_ARCHIVED, but this has been changed to be UF_ARCHIVE, which has the same semantics as the DOS archive attribute instead of inverse semantics like SF_ARCHIVED. After discussion with Bruce Evans, change several things in the msdosfs behavior: Use UF_READONLY to indicate whether a file is writeable instead of file permissions, but don't actually enforce it. Refuse to change attributes on the root directory, because it is special in FAT filesystems, but allow most other attribute changes on directories. Don't set the archive attribute on a directory when its modification time is updated. Windows and DOS don't set the archive attribute in that scenario, so we are now bug-for-bug compatible. smbfs_node.c, smbfs_vnops.c: Add support for UF_HIDDEN, UF_SYSTEM, UF_READONLY and UF_ARCHIVE in SMBFS. This is similar to changes that Apple has made in their version of SMBFS (as of smb-583.8, posted on opensource.apple.com), but not quite the same. We map SMB_FA_READONLY to UF_READONLY, because UF_READONLY is intended to match the semantics of the DOS readonly flag. The MacOS X code maps both UF_IMMUTABLE and SF_IMMUTABLE to SMB_FA_READONLY, but the immutable flags have stronger meaning than the DOS readonly bit. stat.h: Add definitions for UF_SYSTEM, UF_SPARSE, UF_OFFLINE, UF_REPARSE, UF_ARCHIVE, UF_READONLY and UF_HIDDEN. The definition of UF_HIDDEN is the same as the MacOS X definition. Add commented-out definitions of UF_COMPRESSED and UF_TRACKED. They are defined in MacOS X (as of 10.8.2), but we do not implement them (yet). ufs_vnops.c: Add support for getting and setting UF_ARCHIVE, UF_HIDDEN, UF_OFFLINE, UF_READONLY, UF_REPARSE, UF_SPARSE, and UF_SYSTEM in UFS. Alphabetize the flags that are supported. These new flags are only stored, UFS does not take any action if the flag is set. Sponsored by: Spectra Logic Reviewed by: bde (earlier version)
* Add a few examples.joel2013-03-151-1/+19
| | | | Obtained from: OpenBSD
* When WCHAR_MIN == 0 the check if a wchar_t value will always be true. Inandrew2013-01-061-1/+4
| | | | this case skip the test as gcc complains it is always true.
* Undo over-aggressive conversion of spaces to tabs. ie: those withinpeter2012-11-092-6/+6
| | | | format strings, "period, space, space" in comment text, etc.
* Replace spaces with tabs where appropriate.grog2012-11-086-36/+36
| | | | Reminded by: jh@
* Add y flag and environment variable LS_SAMESORT to specify the samegrog2012-11-086-21/+110
| | | | | | | | | | | | | | | | | sorting order for time and name with the -t option. IEEE Std 1003.2 (POSIX.2) mandates that the -t option sort in descending order, and that if two files have the same timestamp, they should be sorted in ascending order of their names. The -r flag reverses both of these sort orders, so they're never the same. This creates significant problems for sequentially named files stored on FAT file systems, where it can be impossible to list them in the order in which they were created. Add , (comma) option to print file sizes grouped and separated by thousands using the non-monetary separator returned by localeconv(3), typically a comma or period. MFC after: 14 days
* Sort option parsing as far as practical.grog2012-11-071-41/+42
|
* Fix bin/ build with a 64-bit ino_t.mdf2012-09-272-7/+11
| | | | Original code by: Gleb Kurtsou
* Add build opton MK_LS_COLORS to control whether ls(1) supports colorsmarcel2012-05-191-1/+4
| | | | | | | (and thus needs to depend on libtermcap). Embedded systems may not want or need colors. Obtained from: Juniper Networks, Inc.
* If ls was invoked with -i but neither -l nor -s, blocksize was used indes2011-10-191-2/+2
| | | | | | | display() to calculate column widths, but was not initialized in main(). This resulted in a division by zero. Noticed by: Michael Butler <imb@protected-networks.net>
* When calculating the width of the blocksize column, ls(1) used 512-bytedes2011-10-181-2/+2
| | | | | | | units (as returned by stat(2)) instead of BLOCKSIZE units. Submitted by: Paul Schenkeveld MFC after: 3 weeks
* Get rid of major/minor number distinction.ed2011-09-284-39/+20
| | | | | | | | | | | | | | | | | | | | | | As of FreeBSD 6, devices can only be opened through devfs. These device nodes don't have major and minor numbers anymore. The st_rdev field in struct stat is simply based a copy of st_ino. Simply display device numbers as hexadecimal, using "%#jx". This is allowed by POSIX, since it explicitly states things like the following (example taken from ls(1)): "If the file is a character special or block special file, the size of the file may be replaced with implementation-defined information associated with the device in question." This makes the output of these commands more compact. For example, ls(1) now uses approximately four columns less. While there, simplify the column length calculation from ls(1) by calling snprintf() with a NULL buffer. Don't be afraid; if needed one can still obtain individual major/minor numbers using stat(1).
* Update sticky(7) cross references.pluknet2011-05-131-4/+4
| | | | | PR: docs/124468 X-MFC with: r218998
* Change all our own code to use st_*tim instead of st_*timespec.ed2010-03-281-32/+32
| | | | Also remove some local patches to diff(1) which are now unneeded.
* Make sure that FTS_COMFOLLOW is not set when the -P option is in effect.jh2010-02-081-2/+6
| | | | | | | | | | Otherwise the -i option will show the inode number of the referenced file for symbolic links given on the command line. Similarly, the file color was printed according to the link target in colorized output. PR: bin/102394 Reviewed by: jilles MFC after: 2 weeks
* Fixes for ls(1) long format (-l) output:jh2010-01-243-21/+50
| | | | | | | | | | - Allow -h option to work if the listing contains at least one device file. - Align major and minor device numbers correctly to the size field. PR: bin/125678 Approved by: trasz (mentor) MFC after: 1 month
* Print full path in the error message. It's possible that fts(3)jh2010-01-241-1/+1
| | | | | | | | | | provides an empty fts_name and reporting the full path is more appropriate especially with the -R option. PR: bin/107515 Submitted by: bde Approved by: trasz (mentor) MFC after: 1 week
* ls: Make -p not inhibit following symlinks.jilles2009-10-131-1/+1
| | | | | | | | | According to the man page, when neither -H/-L nor -F/-d/-l are given, -H is implied. This agrees with POSIX, GNU ls and Solaris ls. This means that -p, although it is very similar to -F, does not prevent the implicit following of symlinks. PR: standards/128546
* Fix regression introduced in r196712 - the 'name' string needstrasz2009-09-021-5/+9
| | | | | | to be rewritten for each file we want to check ACL on. Without this change, ls(1) would check only the ACL on the first file to list.
* Add NFSv4 ACL support to ls(1).trasz2009-08-311-52/+54
|
* Add reference to strmode(3).trasz2009-04-131-0/+1
|
* Turn a tab into a space. This fixes a misalignment for ls -l.imp2008-04-051-2/+2
| | | | Tabs Noticed by: Antoine Brodin
* - Add -D to usage().ru2008-04-042-4/+5
| | | | | - Bump document date for the addition of the -D option. - Reformat a sentence to look like a real sentence.
* Add -D option to specify exact format of date and time output with ls -l.grog2008-04-044-16/+46
|
* Avoid a spurious warning for each whiteout found during "ls -lW".ru2006-10-181-2/+3
| | | | | | | | # ls -lW total 2 -rw-r--r-- 1 root wheel 6 Oct 18 14:46 file1 ls: ./file2: No such file or directory w--------- 0 root wheel 0 Jan 1 1970 file2
* - Improve description of the -A option.ru2006-10-121-7/+12
| | | | | | | | - Document how whiteouts look in the long output. [1] - Sort entry types. - Fix description of the socket type. PR: docs/51921 [1]
* Markup fixes.ru2006-09-171-1/+1
|
* Change the -S and -t options to override each other so that the last onejhb2006-03-242-0/+10
| | | | specified wins to make their interaction less confusing.
* Fix a bug such that if you enabled sorting by size (-S) and enabled ajhb2006-03-241-4/+4
| | | | | | | | | flag to use a time other than modtime (-c, -u, or -U), the output would actually be sorted by the specified time rather than size. This does alter the behavior in the case where both -S and -t are specified. Now, -S is always preferred. Previously, -t was preferred if one of -c, -u, or -U was specified, and -S was preferred otherwise. Perhaps -S and -t should override each other (last one specified wins).
* Add a few more references to -U.jhb2006-03-241-4/+4
|
* Add a new -U flag to instruct ls to use the birthtime for printing orjhb2006-03-247-4/+49
| | | | | | | sorting. Submitted by: Andrzej Tobola ato at iem dot pw dot edu dot pl MFC after: 1 week
* -mdoc sweep.ru2005-11-171-3/+1
|
* Having three options (-a, -A, -I) controlling the output of dottedru2005-11-163-20/+14
| | | | | | | | | | | files is too much and hard to follow. Instead, make the -I option just mean "do not automatically set -A for root". That is, if -A is explicitly set, -I is ignored. Also, document -I in usage(). (The ls.c diff is better viewed relative to rev. 1.80.) No objection: mux Silence from: mnag MFC after: 3 days
* Mention the non-standardness of the -I option in ls(1).mux2005-11-101-1/+2
| | | | | Spotted by: ru MFC after: 3 days
* Add a -I option to disable the automatic -A flag for the super-user.mux2005-11-102-9/+25
| | | | | | PR: bin/86710 Submitted by: Marcus Alves Grando MFC after: 3 days
* fix typos: decribed -> described, preceeded -> precededrse2005-09-061-3/+3
|
* Improved descriptions of block size handling.garys2005-08-311-37/+48
| | | | | | | PR: docs/84765 Submitted by: garys Approved by: keramida MFC after: 3 days
* Remove the EXAMPLES section that describes how to sort by size usingdd2005-06-031-15/+0
| | | | | | | | | | sort(1). This functionality is provided by the -S option now, and it is useful even though a similar effect is achievable with sort(1), since the latter doesn't work in combination with -h. This option is also present in NetBSD, OpenBSD, and GNU fileutils, so there's clearly a demand for it. Noticed by: asmodai
* Improve wording: A sort is "in" a particular order, not "by" add2005-06-031-2/+2
| | | | particular order.
* Add the -S option to sort files by size. NetBSD and OpenBSD alreadydd2005-06-035-12/+43
| | | | | | | | have this option with identical semantics (sorting large files first). -r can be used to reverse the sort if that is desired. PR: 81625 Submitted by: Kostas Blekos <mplekos@physics.upatras.gr>, keramida
* Expand *n't contractions.ru2005-02-131-2/+2
|
* Sync program's usage() with manpage's SYNOPSIS.ru2005-02-091-2/+2
|
* Add the new standard EXIT STATUS section where appropriate.ru2005-01-161-17/+17
| | | | Sort standard sections in the (documented) preferred order.
* The total sum of blocks for the -l and -s option is printed always,joerg2005-01-111-3/+5
| | | | | | | | | | | regardless whether the output is to a terminal or not. As this is consistent with the SUSPv2 specification (even though we do not otherwise fully implement SUSPv2's ls(1) options), document this as it is now, rather than trying to change the behaviour itself. PR: docs/76072 Submitted by: Sebastian Rey <Sebastian.rey@gmx.net> MFC after: 1 week
* /*- or .\"- or #- to begin license clauses.imp2005-01-106-6/+6
|
* Mechanically kill hard sentence breaks.ru2004-07-021-1/+1
|
* Fix some style bugs I introduced pointed out by bde. Also add a blankdwmalone2004-06-231-15/+23
| | | | | | line after the empty variable declarations. Reviewed by: md5
* Use nanoseconds and then lexicographic ordering when the seconds ofdwmalone2004-06-221-6/+42
| | | | | | | | the [acm]time are the same. I was going to use Scott's patch, but I couldn't get the style quite right, so I used a patch of my own. Submitted by: Scott Mitchell <scott+freebsd at fishballoon.org> MFC after: 3 weeks
OpenPOWER on IntegriCloud