Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
coreutils 8.22 to 27 seem to ignore the "-k' option to display size in blocks of 1KiB when "-l" or similar option is used
Version-Release number of selected component (if applicable):
RHEL 7.0 to 7.4
coreutils-8.22-18.el7.x86_64 (no change in the package)
How reproducible:
always
Steps to Reproduce:
1. ls -lk /etc/passwd
Actual results:
-rw-r--r--. 1 root root 1508 Dec 6 09:27 /etc/passwd
Expected results:
-rw-r--r--. 1 root root 2 Dec 11 03:50 /etc/passwd
Additional info:
coreutils-8.4-47.el6.x86_64 from RHEL 6 and coreutils-5.97-34.el5_8.1 from RHEL 5 are okay
coreutils-8.25-17.fc25.x86_64 to coreutils-8.27-17.fc27.x86_64 suffer from the same issue
### sanity
unalias ls
### the same for switches reordered
$ ls -kl /etc/passwd
-rw-r--r--. 1 root root 1508 Dec 6 09:27 /etc/passwd
### correct for --human-readable, --si, and explicit blocksize
$ ls -lh /etc/passwd
-rw-r--r--. 1 root root 1.5K Dec 6 09:27 /etc/passwd
$ ls -l --si /etc/passwd
-rw-r--r--. 1 root root 1.6k Dec 6 09:27 /etc/passwd
$ ls -l --block-size=1k /etc/passwd
-rw-r--r--. 1 root root 2 Dec 6 09:27 /etc/passwd
see also ls info page:
‘-k’
‘--kibibytes’
Set the default block size to its normal value of 1024 bytes,
overriding any contrary specification in environment variables
(*note Block size::). This option is in turn overridden by the
‘--block-size’, ‘-h’ or ‘--human-readable’, and ‘--si’ options.
The ‘-k’ or ‘--kibibytes’ option affects the per-directory block
count written by the ‘-l’ and similar options, and the size written
by the ‘-s’ or ‘--size’ option. It does not affect the file size
written by ‘-l’.
(In reply to Zdenek Pytela from comment #0)
> It does not affect the file size written by ‘-l’.
I believe that the above statement explains the observed behavior. On the other hand, it seems to contradict the preceding sentence. It seems to work fine with the -s option, where it overrides $BLOCKSIZE or $BLOCK_SIZE by the default value 1024.
The RHEL-7 behavior (as well as the documentation) matches the latest upstream. I do not think we can change the behavior but we can improve the documentation.
Does this break any existing scripts or something? Or is the only problem that it does not work as expected?
Sorry for the delay. After reading the info documentation once again, I must admit that it is technically correct as it is, although it is not intuitive.
I propose to change it as follows:
"This option is in turn overridden by the ‘--block-size’, ‘-h’ or
‘--human-readable’, and ‘--si’ options."
-->
"If ‘--block-size’, ‘-h’, ‘--human-readable’, or ‘--si’ options are used,
they take precedence over ‘-k’ or ‘--kibibytes’ even if ‘-k’ or ‘--kibibytes’
is placed after the other options.
Would such a change help to avoid the confusion?
Note that by "per-directory block count written by the -l", they mean the first line of the output in the form "total NNNN". Should this also be clarified?
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHBA-2019:2217
Description of problem: coreutils 8.22 to 27 seem to ignore the "-k' option to display size in blocks of 1KiB when "-l" or similar option is used Version-Release number of selected component (if applicable): RHEL 7.0 to 7.4 coreutils-8.22-18.el7.x86_64 (no change in the package) How reproducible: always Steps to Reproduce: 1. ls -lk /etc/passwd Actual results: -rw-r--r--. 1 root root 1508 Dec 6 09:27 /etc/passwd Expected results: -rw-r--r--. 1 root root 2 Dec 11 03:50 /etc/passwd Additional info: coreutils-8.4-47.el6.x86_64 from RHEL 6 and coreutils-5.97-34.el5_8.1 from RHEL 5 are okay coreutils-8.25-17.fc25.x86_64 to coreutils-8.27-17.fc27.x86_64 suffer from the same issue ### sanity unalias ls ### the same for switches reordered $ ls -kl /etc/passwd -rw-r--r--. 1 root root 1508 Dec 6 09:27 /etc/passwd ### correct for --human-readable, --si, and explicit blocksize $ ls -lh /etc/passwd -rw-r--r--. 1 root root 1.5K Dec 6 09:27 /etc/passwd $ ls -l --si /etc/passwd -rw-r--r--. 1 root root 1.6k Dec 6 09:27 /etc/passwd $ ls -l --block-size=1k /etc/passwd -rw-r--r--. 1 root root 2 Dec 6 09:27 /etc/passwd see also ls info page: ‘-k’ ‘--kibibytes’ Set the default block size to its normal value of 1024 bytes, overriding any contrary specification in environment variables (*note Block size::). This option is in turn overridden by the ‘--block-size’, ‘-h’ or ‘--human-readable’, and ‘--si’ options. The ‘-k’ or ‘--kibibytes’ option affects the per-directory block count written by the ‘-l’ and similar options, and the size written by the ‘-s’ or ‘--size’ option. It does not affect the file size written by ‘-l’.