Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142338587
D34747.id120116.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D34747.id120116.diff
View Options
diff --git a/bin/chflags/chflags.1 b/bin/chflags/chflags.1
--- a/bin/chflags/chflags.1
+++ b/bin/chflags/chflags.1
@@ -208,7 +208,7 @@
In addition, these options override each other and the
command's actions are determined by the last one specified.
.Pp
-You can use "ls -lo" to see the flags of existing files.
+You can use "ls -lO" to see the flags of existing files.
.Pp
Note that the ability to change certain flags is dependent
on the current kernel
diff --git a/bin/ls/ls.h b/bin/ls/ls.h
--- a/bin/ls/ls.h
+++ b/bin/ls/ls.h
@@ -54,8 +54,10 @@
extern int f_samesort; /* sort time and name in same direction */
extern int f_sectime; /* print the real time for all files */
extern int f_size; /* list size in short listing */
+extern int f_sgroup; /* disable showing the name of owning group */
extern int f_slash; /* append a '/' if the file is a directory */
extern int f_sortacross; /* sort across rows, not down columns */
+extern int f_sowner; /* disable showing the owner's name */
extern int f_statustime; /* use time of last mode change */
extern int f_thousands; /* show file sizes with thousands separators */
extern char *f_timeformat; /* user-specified time format */
diff --git a/bin/ls/ls.1 b/bin/ls/ls.1
--- a/bin/ls/ls.1
+++ b/bin/ls/ls.1
@@ -162,6 +162,13 @@
This option cancels the
.Fl P
option.
+.It Fl O
+Include the file flags in a long
+.Pq Fl l
+output.
+See
+.Xr chflags 1
+for a list of file flags and their meanings.
.It Fl P
If argument is a symbolic link, list the link itself rather than the
object the link references.
@@ -301,14 +308,9 @@
.Fl s
options.
.It Fl g
-This option has no effect.
-It is only available for compatibility with
-.Bx 4.3 ,
-where it was used to display the group name in the long
+Display the long
.Pq Fl l
-format output.
-This option is incompatible with
-.St -p1003.1-2008 .
+format output without the file owner's name or number.
.It Fl h
When used with the
.Fl l
@@ -339,14 +341,15 @@
.Pq Fl l
output.
.It Fl o
-Include the file flags in a long
+Display the long
.Pq Fl l
-output.
-This option is incompatible with
-.St -p1003.1-2008 .
-See
-.Xr chflags 1
-for a list of file flags and their meanings.
+format output without the file's group name or number.
+This behavior changed in
+.Fx 14 ,
+to conform to
+.St -p1003.1-2008 ;
+for the previous behavior of displaying file flags, use
+.Pq Fl O .
.It Fl p
Write a slash
.Pq Ql /
@@ -872,7 +875,7 @@
.Xr chflags 1 ) ,
and suffix each filename with a symbol representing its file type:
.Pp
-.Dl $ ls -lioF
+.Dl $ ls -liOF
.Pp
List the files in
.Pa /var/log ,
diff --git a/bin/ls/ls.c b/bin/ls/ls.c
--- a/bin/ls/ls.c
+++ b/bin/ls/ls.c
@@ -142,8 +142,10 @@
static int f_singlecol; /* use single column output */
int f_size; /* list size in short listing */
static int f_sizesort;
+ int f_sgroup; /* disable showing the name of owning group */
int f_slash; /* similar to f_type, but only for dirs */
int f_sortacross; /* sort across rows, not down columns */
+ int f_sowner; /* disable showing owner's name */
int f_statustime; /* use time of last mode change */
static int f_stream; /* stream the output, separate with commas */
int f_thousands; /* show file sizes with thousands separators */
@@ -276,7 +278,7 @@
colorflag = COLORFLAG_AUTO;
#endif
while ((ch = getopt_long(argc, argv,
- "+1ABCD:FGHILPRSTUWXZabcdfghiklmnopqrstuvwxy,", long_opts,
+ "+1ABCD:FGHILOPRSTUWXZabcdfghiklmnopqrstuvwxy,", long_opts,
NULL)) != -1) {
switch (ch) {
/*
@@ -374,6 +376,9 @@
fts_options |= FTS_LOGICAL;
f_nofollow = 0;
break;
+ case 'O':
+ f_flags = 1;
+ break;
case 'P':
fts_options &= ~FTS_COMFOLLOW;
fts_options &= ~FTS_LOGICAL;
@@ -402,7 +407,11 @@
f_listdir = 1;
f_recursive = 0;
break;
- case 'g': /* Compatibility with 4.3BSD. */
+ case 'g':
+ f_longform = 1;
+ f_singlecol = 0;
+ f_stream = 0;
+ f_sowner = 1;
break;
case 'h':
f_humanval = 1;
@@ -421,9 +430,15 @@
break;
case 'n':
f_numericonly = 1;
+ f_longform = 1;
+ f_singlecol = 0;
+ f_stream = 0;
break;
case 'o':
- f_flags = 1;
+ f_longform = 1;
+ f_singlecol = 0;
+ f_stream = 0;
+ f_sgroup = 0;
break;
case 'p':
f_slash = 1;
diff --git a/bin/ls/print.c b/bin/ls/print.c
--- a/bin/ls/print.c
+++ b/bin/ls/print.c
@@ -234,9 +234,12 @@
strmode(sp->st_mode, buf);
aclmode(buf, p);
np = p->fts_pointer;
- (void)printf("%s %*ju %-*s %-*s ", buf, dp->s_nlink,
- (uintmax_t)sp->st_nlink, dp->s_user, np->user, dp->s_group,
- np->group);
+ (void)printf("%s %*ju ", buf, dp->s_nlink,
+ (uintmax_t)sp->st_nlink);
+ if (!f_sowner)
+ (void)printf("%-*s ", dp->s_user, np->user);
+ if (!f_sgroup)
+ (void)printf("%-*s ", dp->s_group, np->group);
if (f_flags)
(void)printf("%-*s ", dp->s_flags, np->flags);
if (f_label)
diff --git a/bin/ls/tests/ls_tests.sh b/bin/ls/tests/ls_tests.sh
--- a/bin/ls/tests/ls_tests.sh
+++ b/bin/ls/tests/ls_tests.sh
@@ -696,7 +696,7 @@
atf_test_case o_flag
o_flag_head()
{
- atf_set "descr" "Verify that the output from ls -o prints out the chflag values or '-' if none are set"
+ atf_set "descr" "Verify that the output from ls -O prints out the chflag values or '-' if none are set"
}
o_flag_body()
@@ -713,9 +713,9 @@
atf_check -e empty -o empty -s exit:0 chflags 0 b.file
atf_check -e empty -o match:"[[:space:]]+uarch[[:space:]]$size+.+a\\.file" \
- -s exit:0 ls -lo a.file
+ -s exit:0 ls -lO a.file
atf_check -e empty -o match:"[[:space:]]+\\-[[:space:]]$size+.+b\\.file" \
- -s exit:0 ls -lo b.file
+ -s exit:0 ls -lO b.file
}
atf_test_case p_flag
diff --git a/bin/ls/util.c b/bin/ls/util.c
--- a/bin/ls/util.c
+++ b/bin/ls/util.c
@@ -227,9 +227,9 @@
{
(void)fprintf(stderr,
#ifdef COLORLS
- "usage: ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuvwxy1,] [--color=when] [-D format]"
+ "usage: ls [-ABCFGHILOPRSTUWZabcdfghiklmnopqrstuvwxy1,] [--color=when] [-D format]"
#else
- "usage: ls [-ABCFHILPRSTUWZabcdfghiklmnopqrstuvwxy1,] [-D format]"
+ "usage: ls [-ABCFHILOPRSTUWZabcdfghiklmnopqrstuvwxy1,] [-D format]"
#endif
" [file ...]\n");
exit(1);
diff --git a/share/skel/dot.shrc b/share/skel/dot.shrc
--- a/share/skel/dot.shrc
+++ b/share/skel/dot.shrc
@@ -22,7 +22,7 @@
alias h='fc -l'
alias j=jobs
alias m="$PAGER"
-alias ll='ls -laFo'
+alias ll='ls -laFO'
alias l='ls -l'
alias g='egrep -i'
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/dosmode.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/dosmode.ksh
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/dosmode.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/dosmode.ksh
@@ -57,7 +57,7 @@
if is_linux; then
read_dos_attributes $path
else
- ls -lo $path | awk '{ print $5 }'
+ ls -lO $path | awk '{ print $5 }'
fi | grep -qwF $flag
}
diff --git a/tools/test/stress2/misc/fts2.sh b/tools/test/stress2/misc/fts2.sh
--- a/tools/test/stress2/misc/fts2.sh
+++ b/tools/test/stress2/misc/fts2.sh
@@ -208,7 +208,7 @@
p->fts_info == FTS_NS) /* stat(2) failed */
continue;
fprintf(stderr, "FAULT\n");
- sprintf(help, "ls -lo %s", p->fts_path);
+ sprintf(help, "ls -lO %s", p->fts_path);
system(help);
fprintf(stderr, "fts_path: %s\n", p->fts_path);
fprintf(stderr, "fts_info: %d %s\n", p->fts_info,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 19, 6:58 PM (1 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27751063
Default Alt Text
D34747.id120116.diff (7 KB)
Attached To
Mode
D34747: ls(1): Change -g and make -n imply -l to implement POSIX
Attached
Detach File
Event Timeline
Log In to Comment