Bug 842040 - df -P gives new lines when where '\n' is in any of the /proc/mounts fields.
df -P gives new lines when where '\n' is in any of the /proc/mounts fields.
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: coreutils (Show other bugs)
6.2
All Linux
unspecified Severity unspecified
: rc
: ---
Assigned To: Ondrej Vasik
Tomas Dolezal
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-21 03:40 EDT by Antony Peter
Modified: 2013-11-21 15:58 EST (History)
10 users (show)

See Also:
Fixed In Version: coreutils-8.4-28.el6
Doc Type: Bug Fix
Doc Text:
Cause: Command df interpreted control characters in the output mount point name. Consequence: It's awkward to read and problematic for scripts when control characters like '\n' are output. Fix: Problematic characters are hidden/replaced by "?" Result: Output with problematic characters is no longer hard to read.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-21 15:58:36 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Antony Peter 2012-07-21 03:40:05 EDT
Description of problem:
df -P" file system information is not "always printed on exactly one line"

Version-Release number of selected component (if applicable):

RHEL 6.2 

How reproducible:

Easily reproducible

[root@dhcp233-121 ~]# mount -o loop cd.iso '/media/Volume
> Identifier'/
[root@dhcp233-121 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                      6.5G  3.2G  3.0G  52% /
tmpfs                 246M     0  246M   0% /dev/shm
/dev/vda1             485M   45M  415M  10% /boot
/root/cd.iso          348K  348K     0 100% /media/Volume
Identifier
[root@dhcp233-121 ~]# df -P
Filesystem         1024-blocks      Used Available Capacity Mounted on
/dev/mapper/VolGroup-lv_root   6748936   3290120   3115984      52% /
tmpfs                   251360         0    251360       0% /dev/shm
/dev/vda1               495844     45755    424489      10% /boot
/root/cd.iso               348       348         0     100% /media/Volume
Identifier
[root@dhcp233-121 ~]#

Steps to Reproduce:

1.Press enter between "Volume" and "Identifier" so it looks like this:
$ genisoimage -V 'Volume
 Identifier' -o cd.iso /test1/ 

 2. Either burn to a disk and let nautilus mount it, or for manual mounting the mount point should include a newline.  If you want to mount it manually, do this, putting a newline between "Volume" and "Identifier":

# mkdir '/media/Volume
Identifier'
# mount -o loop cd.iso '/media/Volume
Identifier'/


3)df -h

  
Actual results:

It prints the information about the file system on two lines:
/dev/sr0   348   348  0 100% /media/Volume
Identifier


[root@dhcp233-121 ~]# df -P
Filesystem         1024-blocks      Used Available Capacity Mounted on
/dev/mapper/VolGroup-lv_root   6748936   3290120   3115984      52% /
tmpfs                   251360         0    251360       0% /dev/shm
/dev/vda1               495844     45755    424489      10% /boot
/root/cd.iso               348       348         0     100% /media/Volume  Identifier
[root@dhcp233-121 ~]#
Expected results:

The manual says about -P: "The information about each file system is always printed on exactly one line"


[root@dhcp233-121 ~]# df -P
Filesystem         1024-blocks      Used Available Capacity Mounted on
/dev/mapper/VolGroup-lv_root   6748936   3290120   3115984      52% /
tmpfs                   251360         0    251360       0% /dev/shm
/dev/vda1               495844     45755    424489      10% /boot
/root/cd.iso               348       348         0     100% /media/Volume Identifier
[root@dhcp233-121 ~]#

Additional info:


This is now handled upstream with:
http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commit;h=3ed70fd5
Comment 5 Pádraig Brady 2012-07-30 07:24:36 EDT
A clarification comment. /etc/mtab contains \012
but glibc will convert the \012 back to \n before sending to df.
So the patch is needed to stop df outputting erroneous new lines.
Comment 6 Kamil Dudka 2012-07-30 07:49:35 EDT
(In reply to comment #5)
> So the patch is needed to stop df outputting erroneous new lines.

You mean a patch to escape special chars back to octal notation?
Comment 7 Pádraig Brady 2012-07-30 18:54:25 EDT
Sorry. The upstream patch is needed
http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commit;h=3ed70fd5

That will convert control chars to to '?'
As a side effect it will keep df from outputting \n
df will not get octal escapes due to the processing done by glibc
df will not output octal escapes for backwards compatibility reasons
Comment 8 Kamil Dudka 2012-07-31 02:56:57 EDT
Oops, I somehow overlooked the link in comment #0.  That should do the job.  Thanks!
Comment 12 RHEL Product and Program Management 2012-09-07 01:08:46 EDT
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.
Comment 27 errata-xmlrpc 2013-11-21 15:58:36 EST
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.

http://rhn.redhat.com/errata/RHSA-2013-1652.html

Note You need to log in before you can comment on or make changes to this bug.