Commit Graph

300 Commits

Author SHA1 Message Date
Baptiste Daroussin
be90c1c6b5 Fix ls -l alignement with new locales
Latest update of locales introduced abbreviated month that follows the regionale
rules meaning that they can be of variable length instead of being arbitrary
truncated to top 3 characters.

To fix alignement, ls now computes the visible length of the abbreviated month,
pads the shorter month with spaces in order to make sure everything is properly
aligned

Reviewed by:	ache, ed, jilles
Differential Revision:	https://reviews.freebsd.org/D4239
2015-12-07 20:48:28 +00:00
Enji Cooper
7b0d44bcba 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

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
2015-12-07 04:03:01 +00:00
Craig Rodrigues
06691045ba Add more text to explain --libxo flag. 2015-12-01 19:18:53 +00:00
Ed Maste
8e5bdf761c Update ls -l tests to use mtime, not birthtime
PR:		204155
Reviewed by:	ngie, rodrigc
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D4040
2015-10-30 20:14:32 +00:00
Enji Cooper
b2d48be1bc Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) and
netbsd-tests.test.mk (r289151)

- Eliminate explicit OBJTOP/SRCTOP setting
- Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk
- Remove unnecessary TESTSDIR setting
- Use SRCTOP where possible for clarity

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Divison
2015-10-12 08:16:03 +00:00
Enji Cooper
c62b746339 Remove all of the syncs
They're unnecessary as shown by further testing on my VM

Requested by: jhb
2015-10-10 01:31:39 +00:00
Enji Cooper
20dbf8ef41 Call sync consistently using atf_check
Remove superfluous sync's
2015-10-06 01:00:12 +00:00
Enji Cooper
910be139a2 Explicitly set BLOCKSIZE to 512 in the environment 2015-10-06 00:55:31 +00:00
Enji Cooper
f46d1be662 Add some more syncs to quiesce the filesystem after creating the
files to see if this fixes deterministic Jenkin failures
2015-10-06 00:23:50 +00:00
Enji Cooper
a0abe9cd7e 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.

X-MFC with: r284388, r288330, r288423
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-10-05 00:33:57 +00:00
Enji Cooper
14044e16bc 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
2015-09-30 17:43:02 +00:00
Enji Cooper
c36a2f462d Add initial testcases for bin/ls
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-09-28 03:36:15 +00:00
Allan Jude
62a1a5f751 Fix whitespace error in ls(1) detected by igor
Approved by:	bcr (mentor)
Sponsored by:	EuroBSDCon DevSummit
2015-09-27 22:05:20 +00:00
Allan Jude
141af3c6ab Use one fewer made up words in the ls(1) man page
PR:		203337
Submitted by:	Mike Dame <damemi@gmail.com>
Approved by:	bcr (mentor)
Sponsored by:	EuroBSDCon DevSummit
2015-09-27 22:02:46 +00:00
Marcel Moolenaar
d1a0d267b7 Upgrade libxo to 0.4.5.
Local changes incorporated by 0.4.5: r284340
Local changes retained: r276260, r282117

Obtained from:	https://github.com/Juniper/libxo
2015-08-24 16:26:20 +00:00
Allan Jude
e9eed90c39 Cast uid and gid to the correct type for display to solve segfault in ls(1) on 32bit arches
Correctly escape literal % for display

This fixes segfaults in 32bit arches caused by r285734

Reviewed by:	ngie
Approved by:	dim
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D3191
2015-07-24 20:20:59 +00:00
Allan Jude
ddaf675fc8 Remove an excess space accidently introduced in the output in ls(1) by r285734
Spotted by:	dim
Approved by:	eadler (mentor)
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D3152
2015-07-22 19:58:21 +00:00
Allan Jude
e5542be424 Fix some issues with the application of libxo to ls(1)
* Add whitespace trimming to some fields (username, group, size, inode, blocks) to avoid whitespace in JSON strings
* fix -m mode, was invalid JSON (repeated keys), and was missing outer array container
* in -n mode, numeric uids and gids were returned as strings

Approved by:	eadler (mentor)
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D2854
2015-07-21 05:03:59 +00:00
Baptiste Daroussin
d4bf4151a5 Prevent potential integer overflow
PR:		192971
Submitted by:	David Carlier <david.carlier@hardenedbsd.org>
2015-07-13 05:56:27 +00:00
Marius Strobl
6bee009f79 Since r284198, ls(1) just always depends libxo(3), not only in case of
MK_LS_COLORS or !RELEASE_CRUNCH.
2015-07-12 18:40:31 +00:00
Alexander Kabaev
0d5beab5be Continue ubreaking ``env LANG=ru_RU.KOI8-R ls -l''.
File names are in current locale as well.
2015-06-17 04:26:48 +00:00
Marcel Moolenaar
284e2b82b2 Unbreak ``env LANG=ru_RU.KOI8-R ls -l''.
Time strings are in the current locale.
2015-06-17 03:12:08 +00:00
Simon J. Gerraty
2ef6d5a7b9 new depends 2015-06-16 23:37:19 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Sean Bruno
a0be738b20 r284198 seems to have left a null format string printf that gcc does *not*
like breaking mips builds.

Submitted by:	Shawn Webb <shawn.webb@hardenedbsd.org>
Obtained from:	HardenedBSD
2015-06-11 02:29:39 +00:00
Marcel Moolenaar
52e4a08c45 Convert ls(1) to use libxo(3).
Obtained from:	Phil Shafer <phil@juniper.net>
Sponsored by:	Juniper Networks, Inc.
2015-06-10 01:27:38 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Xin LI
183714f3f7 It has been long time that when doing 'ls -G /path/to/a/symlink', instead of
using the color of symbolic link, the color is determined by the link target.
This behavior was quite confusing.

Looking at the file history, it looks like that r203665 intends to fix this
but the issue was never actually fixed.

Fix this by not setting FTS_COMFOLLOW when color is requested like what was
done in r203665.

MFC after:	2 weeks
2015-06-08 19:13:04 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Baptiste Daroussin
12cd1730ee Convert bin/ to LIBADD, reduce overlinking allow to build all components as
static
2014-11-25 11:15:40 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Brooks Davis
80189b3b09 Replace all uses of libncurses and libtermcap with their wide character
variants.  This allows usable file system images (i.e. those with both a
shell and an editor) to be created with only one copy of the curses library.

Exp-run:	antoine
PR:		189842
Discussed with:	bapt
Sponsored by:	DARPA, AFRL
2014-07-17 18:24:34 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
cc3f4b9965 Merge from head 2014-05-08 23:54:15 +00:00
Warner Losh
c6063d0da8 Use src.opts.mk in preference to bsd.own.mk except where we need stuff
from the latter.
2014-05-06 04:22:01 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Glen Barber
cc444214a3 Bump Dd, missed as part of r264098 and related commits.
Sponsored by:	The FreeBSD Foundation
2014-04-13 01:47:15 +00:00
Greg Lehey
3490c30476 -k option is compliant with POSIX. 2014-04-04 01:48:25 +00:00
Greg Lehey
a50f6875f6 Typo.
Reported by: Igor Sobrado.
2014-04-03 23:22:04 +00:00
Greg Lehey
8f7aa283ab Add information on standards compliance of many options.
MFC after:	2 weeks
2014-04-03 05:49:28 +00:00
Greg Lehey
3651faa511 Make -f set -a, as required by the standard.
From the original OpenBSD commit message:

  restore the traditional behavior of -f implying -a; apparently Keith
  Bostic forgot to restore it when the -f flag was put back on 2nd of
  September 1989, after being removed on 16th of August as a
  consequence of issues getting it working over NFS, so deviation from
  traditional UNIX behavior in all BSDs looks like an historical
  accident; as a side effect, this change accommodates behavior of
  this option to IEEE Std 1003.1-2008 (``POSIX.1'').

  joint work with jmc@ (who found the inaccuracy in our
  implementation), schwarze@ (who provided a detailed tracking of
  historical facts) and millert@

Submitted by: Igor Sobrado
Discussed with:  mckusick
Obtained from: OpenBSD project
MFC after:  2 weeks
2014-04-03 05:48:28 +00:00
Simon J. Gerraty
d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Kenneth D. Merry
7da1a731c6 Expand the use of stat(2) flags to allow storing some Windows/DOS
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)
2013-08-21 23:04:48 +00:00
Simon J. Gerraty
69e6d7b75e sync from head 2013-04-12 20:48:55 +00:00
Joel Dahl
e9e3a1ab1f Add a few examples.
Obtained from:	OpenBSD
2013-03-15 20:12:54 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
Andrew Turner
3c96f482d9 When WCHAR_MIN == 0 the check if a wchar_t value will always be true. In
this case skip the test as gcc complains it is always true.
2013-01-06 02:50:38 +00:00