)
id 1SpI0k-0000x4-D0
for submit@debbugs.gnu.org; Thu, 12 Jul 2012 07:56:50 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44932)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from ) id 1SpI0e-0000wt-LX
for submit@debbugs.gnu.org; Thu, 12 Jul 2012 07:56:45 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from
) id 1SpHvD-0001JN-2K
for submit@debbugs.gnu.org; Thu, 12 Jul 2012 07:51:08 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI
autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:39302)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from
) id 1SpHvC-0001JJ-VQ
for submit@debbugs.gnu.org; Thu, 12 Jul 2012 07:51:02 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48606)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from
) id 1SpHv7-0003qL-8N
for bug-coreutils@gnu.org; Thu, 12 Jul 2012 07:51:02 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from
) id 1SpHv5-0001IV-D2
for bug-coreutils@gnu.org; Thu, 12 Jul 2012 07:50:57 -0400
Received: from mx1.redhat.com ([209.132.183.28]:41692)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from
) id 1SpHv5-0001I7-5G
for bug-coreutils@gnu.org; Thu, 12 Jul 2012 07:50:55 -0400
Received: from int-mx02.intmail.prod.int.phx2.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6CBorWk013544
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
for ; Thu, 12 Jul 2012 07:50:53 -0400
Received: from [10.36.116.67] (ovpn-116-67.ams2.redhat.com [10.36.116.67])
by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id q6CBopCY015726
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
for ; Thu, 12 Jul 2012 07:50:53 -0400
Message-ID: <4FFEBA1B.90804@draigBrady.com>
Date: Thu, 12 Jul 2012 12:50:51 +0100
From: =?UTF-8?Q?P=C3=A1draig?= Brady
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
rv:6.0) Gecko/20110816 Thunderbird/6.0
MIME-Version: 1.0
X-Enigmail-Version: 1.3.2
Content-Type: text/plain; charset=UTF-8
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id
q6CBorWk013544
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.118.235.17
X-Spam-Score: -6.9 (------)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -6.9 (------)
The edge case where '\n' is in any of the /proc/mounts fields,
will cause problems with errant new lines being output by `df`.
(I notice `findmnt` from util-linux too has the same issue).
So df uses getmntent(3) to get the list, and from its man page we have:
"Since fields in the mtab and fstab files are separated by whitespace,
octal escapes are used to represent the four characters space (\040),
tab (\011), newline (\012) and backslash (\134) in those files when
they occur in one of the four strings in a mntent structure. The rou=E2=
=80=90
tines addmntent() and getmntent() will convert from string representa=E2=
=80=90
tion to escaped representation and back."
So how to handle this. I don't think it's appropriate to
reapply all the escaping in -P mode (which explicitly wants to avoid
multiline entries), since scripts might already be
handling the more common cases of and .
So how about we just change \n -> \012.
This will at least improve the output for humans.
Scripts will not be able to directly use such entries,
but they couldn't anyway, and also processing of other
entries is no longer impacted.
Also `df` since coreutils 8.11 no longer wraps long lines,
preferring to expand alignment. This is easier to read
and avoids a common gotcha in scripts.
So even for non -P mode, we should do the \n -> \012 change.
It's tempting to do this transformation in read_file_system_list()
in gnulib, but that would cause that lib to output an ambiguous
format, and so it's probably best do the processing in each app
as required?
cheers,
P=C3=A1draig.
From unknown Tue Jun 17 01:47:54 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#11922: df doesn't handle \n in mount entries appropriately
Resent-From: Paul Eggert
Original-Sender: debbugs-submit-bounces@debbugs.gnu.org
Resent-CC: bug-coreutils@gnu.org
Resent-Date: Thu, 12 Jul 2012 15:21:01 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 11922
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords:
To: =?UTF-8?Q?P=C3=A1draig?= Brady
Cc: 11922@debbugs.gnu.org
Received: via spool by 11922-submit@debbugs.gnu.org id=B11922.134210641321778
(code B ref 11922); Thu, 12 Jul 2012 15:21:01 +0000
Received: (at 11922) by debbugs.gnu.org; 12 Jul 2012 15:20:13 +0000
Received: from localhost ([127.0.0.1]:36164 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from )
id 1SpLBc-0005fD-Uk
for submit@debbugs.gnu.org; Thu, 12 Jul 2012 11:20:13 -0400
Received: from smtp.cs.ucla.edu ([131.179.128.62]:49675)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from ) id 1SpLBa-0005f5-14
for 11922@debbugs.gnu.org; Thu, 12 Jul 2012 11:20:11 -0400
Received: from localhost (localhost.localdomain [127.0.0.1])
by smtp.cs.ucla.edu (Postfix) with ESMTP id EBB9AA60003;
Thu, 12 Jul 2012 08:14:35 -0700 (PDT)
X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu
Received: from smtp.cs.ucla.edu ([127.0.0.1])
by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id PTqrNUlLXmzj; Thu, 12 Jul 2012 08:14:35 -0700 (PDT)
Received: from [192.168.1.4] (pool-108-23-119-2.lsanca.fios.verizon.net
[108.23.119.2])
by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 9C359A60001;
Thu, 12 Jul 2012 08:14:35 -0700 (PDT)
Message-ID: <4FFEE9DB.6080403@cs.ucla.edu>
Date: Thu, 12 Jul 2012 08:14:35 -0700
From: Paul Eggert
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; Linux i686;
rv:13.0) Gecko/20120615 Thunderbird/13.0.1
MIME-Version: 1.0
References: <4FFEBA1B.90804@draigBrady.com>
In-Reply-To: <4FFEBA1B.90804@draigBrady.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -1.9 (-)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -1.9 (-)
On 07/12/2012 04:50 AM, P=C3=A1draig Brady wrote:
> So how about we just change \n -> \012.
That would mean we also need to change \ -> \\
(otherwise the output would be ambiguous),
and at that point it might make sense to escape
space and tab consistently with the the lower
level interface.
From unknown Tue Jun 17 01:47:54 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#11922: df doesn't handle \n in mount entries appropriately
Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady
Original-Sender: debbugs-submit-bounces@debbugs.gnu.org
Resent-CC: bug-coreutils@gnu.org
Resent-Date: Thu, 12 Jul 2012 15:35:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 11922
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords:
To: Paul Eggert
Cc: 11922@debbugs.gnu.org
Received: via spool by 11922-submit@debbugs.gnu.org id=B11922.134210728023049
(code B ref 11922); Thu, 12 Jul 2012 15:35:02 +0000
Received: (at 11922) by debbugs.gnu.org; 12 Jul 2012 15:34:40 +0000
Received: from localhost ([127.0.0.1]:36202 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from )
id 1SpLPb-0005zi-Qc
for submit@debbugs.gnu.org; Thu, 12 Jul 2012 11:34:40 -0400
Received: from mx1.redhat.com ([209.132.183.28]:24314)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from ) id 1SpLPZ-0005zX-1b
for 11922@debbugs.gnu.org; Thu, 12 Jul 2012 11:34:38 -0400
Received: from int-mx12.intmail.prod.int.phx2.redhat.com
(int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6CFT1ZT009614
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
Thu, 12 Jul 2012 11:29:02 -0400
Received: from [10.36.116.67] (ovpn-116-67.ams2.redhat.com [10.36.116.67])
by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
id q6CFSx2k025467
(version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO);
Thu, 12 Jul 2012 11:29:01 -0400
Message-ID: <4FFEED3B.6060504@draigBrady.com>
Date: Thu, 12 Jul 2012 16:28:59 +0100
From: =?UTF-8?Q?P=C3=A1draig?= Brady
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
rv:6.0) Gecko/20110816 Thunderbird/6.0
MIME-Version: 1.0
References: <4FFEBA1B.90804@draigBrady.com> <4FFEE9DB.6080403@cs.ucla.edu>
In-Reply-To: <4FFEE9DB.6080403@cs.ucla.edu>
X-Enigmail-Version: 1.3.2
Content-Type: text/plain; charset=UTF-8
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id
q6CFT1ZT009614
X-Spam-Score: -6.9 (------)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -6.9 (------)
On 07/12/2012 04:14 PM, Paul Eggert wrote:
> On 07/12/2012 04:50 AM, P=C3=A1draig Brady wrote:
>> So how about we just change \n -> \012.
>=20
> That would mean we also need to change \ -> \\
> (otherwise the output would be ambiguous),
> and at that point it might make sense to escape
> space and tab consistently with the the lower
> level interface.
Right that would be the most consistent and general.
I detailed in the previous mail why I was wary.
It would change the output for df etc. in possibly more
common cases of space and tab used in names.
Maybe that case is uncommon enough to not worry about, but...
more problematically it would change the output from
the lib, so that whereas before any program could unambiguously
access the returned entries directly, now they'd have
to unescape.
seems a bit dangerous to me.
cheers,
P=C3=A1draig.
From unknown Tue Jun 17 01:47:54 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#11922: df doesn't handle \n in mount entries appropriately
Resent-From: Paul Eggert
Original-Sender: debbugs-submit-bounces@debbugs.gnu.org
Resent-CC: bug-coreutils@gnu.org
Resent-Date: Thu, 12 Jul 2012 15:42:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 11922
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords:
To: =?UTF-8?Q?P=C3=A1draig?= Brady
Cc: 11922@debbugs.gnu.org
Received: via spool by 11922-submit@debbugs.gnu.org id=B11922.134210766523590
(code B ref 11922); Thu, 12 Jul 2012 15:42:02 +0000
Received: (at 11922) by debbugs.gnu.org; 12 Jul 2012 15:41:05 +0000
Received: from localhost ([127.0.0.1]:36208 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from )
id 1SpLVp-00068R-0F
for submit@debbugs.gnu.org; Thu, 12 Jul 2012 11:41:05 -0400
Received: from smtp.cs.ucla.edu ([131.179.128.62]:50648)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from ) id 1SpLVm-00068K-TM
for 11922@debbugs.gnu.org; Thu, 12 Jul 2012 11:41:03 -0400
Received: from localhost (localhost.localdomain [127.0.0.1])
by smtp.cs.ucla.edu (Postfix) with ESMTP id 07CDBA60003;
Thu, 12 Jul 2012 08:35:30 -0700 (PDT)
X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu
Received: from smtp.cs.ucla.edu ([127.0.0.1])
by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id ko9MPkhP4KNh; Thu, 12 Jul 2012 08:35:29 -0700 (PDT)
Received: from [192.168.1.4] (pool-108-23-119-2.lsanca.fios.verizon.net
[108.23.119.2])
by smtp.cs.ucla.edu (Postfix) with ESMTPSA id A7745A60001;
Thu, 12 Jul 2012 08:35:29 -0700 (PDT)
Message-ID: <4FFEEEC1.1010507@cs.ucla.edu>
Date: Thu, 12 Jul 2012 08:35:29 -0700
From: Paul Eggert
Organization: UCLA Computer Science Department
User-Agent: Mozilla/5.0 (X11; Linux i686;
rv:13.0) Gecko/20120615 Thunderbird/13.0.1
MIME-Version: 1.0
References: <4FFEBA1B.90804@draigBrady.com> <4FFEE9DB.6080403@cs.ucla.edu>
<4FFEED3B.6060504@draigBrady.com>
In-Reply-To: <4FFEED3B.6060504@draigBrady.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -1.9 (-)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -1.9 (-)
On 07/12/2012 08:28 AM, P=C3=A1draig Brady wrote:
> more problematically it would change the output from
> the lib
Ah, sorry, I was talking only about df's output,
independently of how it gets the info from the underlying
library. Surely the C library API should return a string
with raw newlines etc. in it, leaving it up to 'df' how to
display it?
From unknown Tue Jun 17 01:47:54 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#11922: df doesn't handle \n in mount entries appropriately
Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady
Original-Sender: debbugs-submit-bounces@debbugs.gnu.org
Resent-CC: bug-coreutils@gnu.org
Resent-Date: Thu, 12 Jul 2012 16:18:01 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 11922
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords:
To: Paul Eggert
Cc: 11922@debbugs.gnu.org
Received: via spool by 11922-submit@debbugs.gnu.org id=B11922.134210983826691
(code B ref 11922); Thu, 12 Jul 2012 16:18:01 +0000
Received: (at 11922) by debbugs.gnu.org; 12 Jul 2012 16:17:18 +0000
Received: from localhost ([127.0.0.1]:36247 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from )
id 1SpM4s-0006wS-Ct
for submit@debbugs.gnu.org; Thu, 12 Jul 2012 12:17:18 -0400
Received: from mx1.redhat.com ([209.132.183.28]:7370)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from ) id 1SpM4q-0006wK-6d
for 11922@debbugs.gnu.org; Thu, 12 Jul 2012 12:17:17 -0400
Received: from int-mx01.intmail.prod.int.phx2.redhat.com
(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6CGBggr017968
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
Thu, 12 Jul 2012 12:11:42 -0400
Received: from [10.36.116.67] (ovpn-116-67.ams2.redhat.com [10.36.116.67])
by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id q6CGBdgc023171
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
Thu, 12 Jul 2012 12:11:41 -0400
Message-ID: <4FFEF73B.7040903@draigBrady.com>
Date: Thu, 12 Jul 2012 17:11:39 +0100
From: =?UTF-8?Q?P=C3=A1draig?= Brady
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
rv:6.0) Gecko/20110816 Thunderbird/6.0
MIME-Version: 1.0
References: <4FFEBA1B.90804@draigBrady.com> <4FFEE9DB.6080403@cs.ucla.edu>
<4FFEED3B.6060504@draigBrady.com> <4FFEEEC1.1010507@cs.ucla.edu>
In-Reply-To: <4FFEEEC1.1010507@cs.ucla.edu>
X-Enigmail-Version: 1.3.2
Content-Type: text/plain; charset=UTF-8
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id
q6CGBggr017968
X-Spam-Score: -6.9 (------)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -6.9 (------)
On 07/12/2012 04:35 PM, Paul Eggert wrote:
> On 07/12/2012 08:28 AM, P=C3=A1draig Brady wrote:
>> more problematically it would change the output from
>> the lib
>=20
> Ah, sorry, I was talking only about df's output,
> independently of how it gets the info from the underlying
> library. Surely the C library API should return a string
> with raw newlines etc. in it, leaving it up to 'df' how to
> display it?
>=20
Oops, right.
I misread "with the lower level" as "in the lower level" :)
So just considering df, the tradeoff is ambiguous
output in the presence of \n when just escaping \n,
or unambiguous output which is backwards incompatible
in the presence of ,,.
It's interesting that the low level interface only
considers the above 3 chars. I guess that's so
that _programs_ can use isblank() and getline() to
parse the output robustly.
However it might be better for df to escape all
control characters (\r,\f,...) so that _humans_
can parse too.
cheers,
P=C3=A1draig.
From unknown Tue Jun 17 01:47:54 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#11922: df doesn't handle \n in mount entries appropriately
Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady
Original-Sender: debbugs-submit-bounces@debbugs.gnu.org
Resent-CC: bug-coreutils@gnu.org
Resent-Date: Fri, 13 Jul 2012 15:04:01 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 11922
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords:
To: Paul Eggert
Cc: 11922@debbugs.gnu.org
Received: via spool by 11922-submit@debbugs.gnu.org id=B11922.13421918261887
(code B ref 11922); Fri, 13 Jul 2012 15:04:01 +0000
Received: (at 11922) by debbugs.gnu.org; 13 Jul 2012 15:03:46 +0000
Received: from localhost ([127.0.0.1]:39497 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from )
id 1SphPG-0000UN-0Q
for submit@debbugs.gnu.org; Fri, 13 Jul 2012 11:03:46 -0400
Received: from mx1.redhat.com ([209.132.183.28]:11615)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from ) id 1SphPD-0000UF-QP
for 11922@debbugs.gnu.org; Fri, 13 Jul 2012 11:03:45 -0400
Received: from int-mx02.intmail.prod.int.phx2.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6DEvvw6020720
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
Fri, 13 Jul 2012 10:57:57 -0400
Received: from [10.36.116.78] (ovpn-116-78.ams2.redhat.com [10.36.116.78])
by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id q6DEvstu024414
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
Fri, 13 Jul 2012 10:57:56 -0400
Message-ID: <50003772.9000003@draigBrady.com>
Date: Fri, 13 Jul 2012 15:57:54 +0100
From: =?UTF-8?Q?P=C3=A1draig?= Brady
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
rv:6.0) Gecko/20110816 Thunderbird/6.0
MIME-Version: 1.0
References: <4FFEBA1B.90804@draigBrady.com> <4FFEE9DB.6080403@cs.ucla.edu>
<4FFEED3B.6060504@draigBrady.com> <4FFEEEC1.1010507@cs.ucla.edu>
<4FFEF73B.7040903@draigBrady.com>
In-Reply-To: <4FFEF73B.7040903@draigBrady.com>
X-Enigmail-Version: 1.3.2
Content-Type: multipart/mixed; boundary="------------010504070500080706020700"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
X-Spam-Score: -6.9 (------)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -6.9 (------)
This is a multi-part message in MIME format.
--------------010504070500080706020700
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id q6DEvvw6020720
On 07/12/2012 05:11 PM, P=C3=A1draig Brady wrote:
> On 07/12/2012 04:35 PM, Paul Eggert wrote:
>> On 07/12/2012 08:28 AM, P=C3=A1draig Brady wrote:
>>> more problematically it would change the output from
>>> the lib
>>
>> Ah, sorry, I was talking only about df's output,
>> independently of how it gets the info from the underlying
>> library. Surely the C library API should return a string
>> with raw newlines etc. in it, leaving it up to 'df' how to
>> display it?
>>
>=20
> Oops, right.
> I misread "with the lower level" as "in the lower level" :)
>=20
> So just considering df, the tradeoff is ambiguous
> output in the presence of \n when just escaping \n,
> or unambiguous output which is backwards incompatible
> in the presence of ,,.
>=20
> It's interesting that the low level interface only
> considers the above 3 chars. I guess that's so
> that _programs_ can use isblank() and getline() to
> parse the output robustly.
> However it might be better for df to escape all
> control characters (\r,\f,...) so that _humans_
> can parse too.
That attached patch takes the simplest approach
and just replaces '\n' with '?'.
Reasons are detailed in the commit message.
I was considering doing something a bit more general,
along the lines of unicode_displayable() in fslint:
http://code.google.com/p/fslint/source/browse/tags/2.42/fslint-gui#92
While that could be generally useful within coreutils,
I've gone with the simpler approach for now.
cheers,
P=C3=A1draig.
--------------010504070500080706020700
Content-Type: text/plain;
name="df-newlines.diff"
Content-Disposition: attachment;
filename="df-newlines.diff"
Content-Transfer-Encoding: base64
RnJvbSA3Y2QyZDAyM2FmMzkyNjJlZjEzNGQ1Y2MyZDEyMDM0MzJmZmZiODA3IE1vbiBTZXAg
MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiA9P1VURi04P3E/UD1DMz1BMWRyYWlnPTIwQnJhZHk/
PSA8UEBkcmFpZ0JyYWR5LmNvbT4KRGF0ZTogRnJpLCAxMyBKdWwgMjAxMiAwMjoyNzoyNiAr
MDEwMApTdWJqZWN0OiBbUEFUQ0hdIGRmOiBkb24ndCBvdXRwdXQgJ1xuJyBjaGFyYWN0ZXJz
IGluIGEgbW91bnQgcG9pbnQgbmFtZQoKSXQncyBhd2t3YXJkIHRvIHJlYWQgYW5kIHByb2Js
ZW1hdGljIGZvciBzY3JpcHRzIHdoZW4KbmV3IGxpbmVzIG5vdCBhc3NvY2lhdGVkIHdpdGgg
dGhlIHJlY29yZCBkZWxpbWl0ZXJzIGFyZSBvdXRwdXQuCgpOb3RlIG90aGVyIGZpZWxkcyBh
cmUgYWxyZWFkeSBoYW5kbGVkIHdpdGggbWJzYWxpZ24sCndoaWNoIGNvbnZlcnRzIG5vbiBw
cmludGFibGUgY2hhcnMgdG8gdGhlIHJlcGxhY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CAoY2VsbCwgMCkpOwpAQCAt
NjYxLDcgKzY4MCwxMCBAQCBnZXRfZGV2IChjaGFyIGNvbnN0ICpkaXNrLCBjaGFyIGNvbnN0
ICptb3VudF9wb2ludCwKICAgICAgICAgfQogCiAgICAgICBpZiAoY2VsbCkKLSAgICAgICAg
d2lkdGhzW2ZpZWxkXSA9IE1BWCAod2lkdGhzW2ZpZWxkXSwgbWJzd2lkdGggKGNlbGwsIDAp
KTsKKyAgICAgICAgeworICAgICAgICAgIGhpZGVfcHJvYmxlbWF0aWNfY2hhcnMgKGNlbGwp
OworICAgICAgICAgIHdpZHRoc1tmaWVsZF0gPSBNQVggKHdpZHRoc1tmaWVsZF0sIG1ic3dp
ZHRoIChjZWxsLCAwKSk7CisgICAgICAgIH0KICAgICAgIHRhYmxlW25yb3dzLTFdW2ZpZWxk
XSA9IGNlbGw7CiAgICAgfQogfQotLSAKMS43LjYuNAoK
--------------010504070500080706020700--
From unknown Tue Jun 17 01:47:54 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#11922: df doesn't handle \n in mount entries appropriately
Resent-From: Jim Meyering
Original-Sender: debbugs-submit-bounces@debbugs.gnu.org
Resent-CC: bug-coreutils@gnu.org
Resent-Date: Fri, 13 Jul 2012 15:09:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 11922
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords:
To: =?UTF-8?Q?P=C3=A1draig?= Brady
Cc: 11922@debbugs.gnu.org, Paul Eggert
Received: via spool by 11922-submit@debbugs.gnu.org id=B11922.13421921412372
(code B ref 11922); Fri, 13 Jul 2012 15:09:02 +0000
Received: (at 11922) by debbugs.gnu.org; 13 Jul 2012 15:09:01 +0000
Received: from localhost ([127.0.0.1]:39510 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from )
id 1SphUK-0000cD-Al
for submit@debbugs.gnu.org; Fri, 13 Jul 2012 11:09:01 -0400
Received: from mx.meyering.net ([88.168.87.75]:44837)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from ) id 1SphUH-0000c4-PC
for 11922@debbugs.gnu.org; Fri, 13 Jul 2012 11:08:58 -0400
Received: from rho.meyering.net (rho.meyering.net [127.0.0.1])
by rho.meyering.net (Acme Bit-Twister) with ESMTP id D1B6D60E03;
Fri, 13 Jul 2012 17:03:18 +0200 (CEST)
From: Jim Meyering
In-Reply-To: <50003772.9000003@draigBrady.com> ("=?UTF-8?Q?P=C3=A1draig?= Brady"'s message of
"Fri, 13 Jul 2012 15:57:54 +0100")
References: <4FFEBA1B.90804@draigBrady.com> <4FFEE9DB.6080403@cs.ucla.edu>
<4FFEED3B.6060504@draigBrady.com> <4FFEEEC1.1010507@cs.ucla.edu>
<4FFEF73B.7040903@draigBrady.com> <50003772.9000003@draigBrady.com>
Date: Fri, 13 Jul 2012 17:03:18 +0200
Message-ID: <87hatbsnyh.fsf@rho.meyering.net>
Lines: 56
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -1.9 (-)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -1.9 (-)
P=E1draig Brady wrote:
> On 07/12/2012 05:11 PM, P=E1draig Brady wrote:
>> On 07/12/2012 04:35 PM, Paul Eggert wrote:
>>> On 07/12/2012 08:28 AM, P=E1draig Brady wrote:
>>>> more problematically it would change the output from
>>>> the lib
>>>
>>> Ah, sorry, I was talking only about df's output,
>>> independently of how it gets the info from the underlying
>>> library. Surely the C library API should return a string
>>> with raw newlines etc. in it, leaving it up to 'df' how to
>>> display it?
>>>
>>
>> Oops, right.
>> I misread "with the lower level" as "in the lower level" :)
>>
>> So just considering df, the tradeoff is ambiguous
>> output in the presence of \n when just escaping \n,
>> or unambiguous output which is backwards incompatible
>> in the presence of ,,.
>>
>> It's interesting that the low level interface only
>> considers the above 3 chars. I guess that's so
>> that _programs_ can use isblank() and getline() to
>> parse the output robustly.
>> However it might be better for df to escape all
>> control characters (\r,\f,...) so that _humans_
>> can parse too.
>
> That attached patch takes the simplest approach
> and just replaces '\n' with '?'.
...
>
> * src/df.c (hide_problematic_chars): Replace '\n' with '\?'.
Thanks. That looks fine, but shouldn't the '\?' above be just '?'
> * NEWS: Mention the fix.
> ---
> NEWS | 5 +++++
> src/df.c | 24 +++++++++++++++++++++++-
> 2 files changed, 28 insertions(+), 1 deletions(-)
>
> diff --git a/NEWS b/NEWS
> index b8d3cbb..b4bd7e4 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -13,6 +13,11 @@ GNU coreutils NEWS =
-*- outline -*-
> date: invalid date '\260'
> [This bug was present in "the beginning".]
>
> + df no longer outputs '\n' characters present in the mount point name.
> + Such characters are replaced with '?' so for example, scripts consuming
> + lines output by df, can work reliably.
> + [This bug was present in "the beginning".]
From unknown Tue Jun 17 01:47:54 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#11922: df doesn't handle \n in mount entries appropriately
Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady
Original-Sender: debbugs-submit-bounces@debbugs.gnu.org
Resent-CC: bug-coreutils@gnu.org
Resent-Date: Fri, 13 Jul 2012 15:12:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 11922
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords:
To: Jim Meyering
Cc: 11922@debbugs.gnu.org, Paul Eggert
Received: via spool by 11922-submit@debbugs.gnu.org id=B11922.13421922782585
(code B ref 11922); Fri, 13 Jul 2012 15:12:02 +0000
Received: (at 11922) by debbugs.gnu.org; 13 Jul 2012 15:11:18 +0000
Received: from localhost ([127.0.0.1]:39514 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from )
id 1SphWY-0000fe-Gt
for submit@debbugs.gnu.org; Fri, 13 Jul 2012 11:11:18 -0400
Received: from mx1.redhat.com ([209.132.183.28]:53038)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from ) id 1SphWV-0000fW-JC
for 11922@debbugs.gnu.org; Fri, 13 Jul 2012 11:11:17 -0400
Received: from int-mx02.intmail.prod.int.phx2.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6DF5aOt015964
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
Fri, 13 Jul 2012 11:05:36 -0400
Received: from [10.36.116.78] (ovpn-116-78.ams2.redhat.com [10.36.116.78])
by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id q6DF5YMt027603
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
Fri, 13 Jul 2012 11:05:35 -0400
Message-ID: <5000393E.7010509@draigBrady.com>
Date: Fri, 13 Jul 2012 16:05:34 +0100
From: =?UTF-8?Q?P=C3=A1draig?= Brady
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
rv:6.0) Gecko/20110816 Thunderbird/6.0
MIME-Version: 1.0
References: <4FFEBA1B.90804@draigBrady.com> <4FFEE9DB.6080403@cs.ucla.edu>
<4FFEED3B.6060504@draigBrady.com> <4FFEEEC1.1010507@cs.ucla.edu>
<4FFEF73B.7040903@draigBrady.com> <50003772.9000003@draigBrady.com>
<87hatbsnyh.fsf@rho.meyering.net>
In-Reply-To: <87hatbsnyh.fsf@rho.meyering.net>
X-Enigmail-Version: 1.3.2
Content-Type: text/plain; charset=ISO-8859-1
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id
q6DF5aOt015964
X-Spam-Score: -6.9 (------)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -6.9 (------)
On 07/13/2012 04:03 PM, Jim Meyering wrote:
> P=E1draig Brady wrote:
>> On 07/12/2012 05:11 PM, P=E1draig Brady wrote:
>> * src/df.c (hide_problematic_chars): Replace '\n' with '\?'.
>=20
> Thanks. That looks fine, but shouldn't the '\?' above be just '?'
oops thanks.
From unknown Tue Jun 17 01:47:54 2025
MIME-Version: 1.0
X-Mailer: MIME-tools 5.428 (Entity 5.428)
X-Loop: help-debbugs@gnu.org
From: help-debbugs@gnu.org (GNU bug Tracking System)
To: =?UTF-8?Q?P=C3=A1draig?= Brady
Subject: bug#11922: closed (Re: bug#11922: df doesn't handle \n in mount
entries appropriately)
Message-ID:
References: <5003726B.507@draigBrady.com> <4FFEBA1B.90804@draigBrady.com>
X-Gnu-PR-Message: they-closed 11922
X-Gnu-PR-Package: coreutils
Reply-To: 11922@debbugs.gnu.org
Date: Mon, 16 Jul 2012 01:53:03 +0000
Content-Type: multipart/mixed; boundary="----------=_1342403583-15961-1"
This is a multi-part message in MIME format...
------------=_1342403583-15961-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8"
Your bug report
#11922: df doesn't handle \n in mount entries appropriately
which was filed against the coreutils package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 11922@debbugs.gnu.org.
--=20
11922: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D11922
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
------------=_1342403583-15961-1
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
Received: (at 11922-done) by debbugs.gnu.org; 16 Jul 2012 01:52:28 +0000
Received: from localhost ([127.0.0.1]:43396 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from )
id 1SqaU7-00048i-Dr
for submit@debbugs.gnu.org; Sun, 15 Jul 2012 21:52:27 -0400
Received: from mx1.redhat.com ([209.132.183.28]:31932)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from ) id 1SqaU4-00048a-4i
for 11922-done@debbugs.gnu.org; Sun, 15 Jul 2012 21:52:25 -0400
Received: from int-mx09.intmail.prod.int.phx2.redhat.com
(int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])
by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6G1kMAb020454
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
Sun, 15 Jul 2012 21:46:22 -0400
Received: from [10.36.116.17] (ovpn-116-17.ams2.redhat.com [10.36.116.17])
by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
id q6G1kJwa001510
(version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO);
Sun, 15 Jul 2012 21:46:21 -0400
Message-ID: <5003726B.507@draigBrady.com>
Date: Mon, 16 Jul 2012 02:46:19 +0100
From: =?ISO-8859-1?Q?P=E1draig_Brady?=
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
rv:6.0) Gecko/20110816 Thunderbird/6.0
MIME-Version: 1.0
To: Jim Meyering
Subject: Re: bug#11922: df doesn't handle \n in mount entries appropriately
References: <4FFEBA1B.90804@draigBrady.com> <4FFEE9DB.6080403@cs.ucla.edu>
<4FFEED3B.6060504@draigBrady.com> <4FFEEEC1.1010507@cs.ucla.edu>
<4FFEF73B.7040903@draigBrady.com> <50003772.9000003@draigBrady.com>
<87hatbsnyh.fsf@rho.meyering.net> <5000393E.7010509@draigBrady.com>
In-Reply-To: <5000393E.7010509@draigBrady.com>
X-Enigmail-Version: 1.3.2
Content-Type: multipart/mixed; boundary="------------090403070007050203010607"
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: 11922-done
Cc: 11922-done@debbugs.gnu.org, Paul Eggert
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -6.9 (------)
This is a multi-part message in MIME format.
--------------090403070007050203010607
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id q6G1kMAb020454
On 07/13/2012 04:05 PM, P=E1draig Brady wrote:
> On 07/13/2012 04:03 PM, Jim Meyering wrote:
>> P=E1draig Brady wrote:
>>> On 07/12/2012 05:11 PM, P=E1draig Brady wrote:
>=20
>>> * src/df.c (hide_problematic_chars): Replace '\n' with '\?'.
>>
>> Thanks. That looks fine, but shouldn't the '\?' above be just '?'
>=20
> oops thanks.
I adjusted a bit and now replace all control chars (< 0x20) with '?'.
They're easy to handle in all encodings and can only be problematic.
I added a test too.
I've pushed the attached, so I'm marking this done.
cheers,
P=E1draig.
--------------090403070007050203010607
Content-Type: text/plain;
name="df-newlines.diff"
Content-Disposition: attachment;
filename="df-newlines.diff"
Content-Transfer-Encoding: 7bit
>From 8d91451e237c50284b7de99228ea814c55c5deb1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?=
Date: Fri, 13 Jul 2012 02:27:26 +0100
Subject: [PATCH] df: don't output control characters in a mount point name
It's awkward to read and problematic for scripts when
control characters like '\n' are output.
Note other fields are already handled with mbsalign,
which converts non printable chars to the replacement char.
A caveat to note with that, is the replacement char takes
a place in the field and so possibly truncates the field
if it was the widest field in the records.
Note a more general replacement function, that
handles all printable, or white space characters,
would require more sophisticated support for various
encodings, and the complexity vs benefit was not
deemed beneficial enough at present.
Perhaps in future a more general replacement function
could be shared between the various utilities.
Note is unaffected in any field,
which could impact scripts processing the output.
However any of the number fields at least could have
spaces considering `LANG=fr_FR df -B\'1`, so it's
probably best to leave spaces, which also allows
scripts to handle mount points with spaces without change.
* src/df.c (hide_problematic_chars): Replace control chars with '?'.
* tests/df/problematic-chars: Add a new root only test.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the fix.
---
NEWS | 5 +++++
src/df.c | 24 +++++++++++++++++++++++-
tests/Makefile.am | 1 +
tests/df/problematic-chars | 44 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 73 insertions(+), 1 deletions(-)
create mode 100755 tests/df/problematic-chars
diff --git a/NEWS b/NEWS
index b8d3cbb..113b30a 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,11 @@ GNU coreutils NEWS -*- outline -*-
date: invalid date '\260'
[This bug was present in "the beginning".]
+ df no longer outputs control characters present in the mount point name.
+ Such characters are replaced with '?', so for example, scripts consuming
+ lines output by df, can work reliably.
+ [This bug was present in "the beginning".]
+
head --lines=-N (-n-N) now resets the read pointer of a seekable input file.
This means that "head -n-3" no longer consumes all of its input, and lines
not output by head may be processed by other programs. For example, this
diff --git a/src/df.c b/src/df.c
index 7e30d57..5dc3d2d 100644
--- a/src/df.c
+++ b/src/df.c
@@ -192,6 +192,23 @@ static struct option const long_options[] =
{NULL, 0, NULL, 0}
};
+/* Replace problematic chars with '?'.
+ Since only control characters are currently considered,
+ this should work in all encodings. */
+
+static char*
+hide_problematic_chars (char *cell)
+{
+ char *p = cell;
+ while (*p)
+ {
+ if (iscntrl (to_uchar (*p)))
+ *p = '?';
+ p++;
+ }
+ return cell;
+}
+
/* Dynamically allocate a row of pointers in TABLE, which
can then be accessed with standard 2D array notation. */
@@ -315,6 +332,8 @@ get_header (void)
if (!cell)
xalloc_die ();
+ hide_problematic_chars (cell);
+
table[nrows-1][field] = cell;
widths[field] = MAX (widths[field], mbswidth (cell, 0));
@@ -661,7 +680,10 @@ get_dev (char const *disk, char const *mount_point,
}
if (cell)
- widths[field] = MAX (widths[field], mbswidth (cell, 0));
+ {
+ hide_problematic_chars (cell);
+ widths[field] = MAX (widths[field], mbswidth (cell, 0));
+ }
table[nrows-1][field] = cell;
}
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index dfac9a0..944c7d2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -31,6 +31,7 @@ root_tests = \
cp/capability \
cp/sparse-fiemap \
dd/skip-seek-past-dev \
+ df/problematic-chars \
install/install-C-root \
ls/capability \
ls/nameless-uid \
diff --git a/tests/df/problematic-chars b/tests/df/problematic-chars
new file mode 100755
index 0000000..801c4d9
--- /dev/null
+++ b/tests/df/problematic-chars
@@ -0,0 +1,44 @@
+#!/bin/sh
+# Ensure that df outputs one line per entry
+
+# Copyright (C) 2012 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+print_ver_ df
+require_root_
+
+mnt='mount
+point'
+
+cwd=$(pwd)
+cleanup_() { cd /; umount "$cwd/$mnt"; }
+
+skip=0
+# Create a file system, then mount it.
+dd if=/dev/zero of=blob bs=8192 count=200 > /dev/null 2>&1 \
+ || skip=1
+mkdir "$mnt" || skip=1
+mkfs -t ext2 -F blob \
+ || skip_ "failed to create ext2 file system"
+
+mount -oloop blob "$mnt" || skip=1
+
+test $skip = 1 \
+ && skip_ "insufficient mount/ext2 support"
+
+test $(df "$mnt" | wc -l) = 2 || fail=1
+
+Exit $fail
--
1.7.6.4
--------------090403070007050203010607--
------------=_1342403583-15961-1
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
Received: (at submit) by debbugs.gnu.org; 12 Jul 2012 11:56:50 +0000
Received: from localhost ([127.0.0.1]:35372 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from )
id 1SpI0k-0000x4-D0
for submit@debbugs.gnu.org; Thu, 12 Jul 2012 07:56:50 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44932)
by debbugs.gnu.org with esmtp (Exim 4.72)
(envelope-from ) id 1SpI0e-0000wt-LX
for submit@debbugs.gnu.org; Thu, 12 Jul 2012 07:56:45 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from
) id 1SpHvD-0001JN-2K
for submit@debbugs.gnu.org; Thu, 12 Jul 2012 07:51:08 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI
autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:39302)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from
) id 1SpHvC-0001JJ-VQ
for submit@debbugs.gnu.org; Thu, 12 Jul 2012 07:51:02 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48606)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from
) id 1SpHv7-0003qL-8N
for bug-coreutils@gnu.org; Thu, 12 Jul 2012 07:51:02 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from
) id 1SpHv5-0001IV-D2
for bug-coreutils@gnu.org; Thu, 12 Jul 2012 07:50:57 -0400
Received: from mx1.redhat.com ([209.132.183.28]:41692)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from
) id 1SpHv5-0001I7-5G
for bug-coreutils@gnu.org; Thu, 12 Jul 2012 07:50:55 -0400
Received: from int-mx02.intmail.prod.int.phx2.redhat.com
(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6CBorWk013544
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
for ; Thu, 12 Jul 2012 07:50:53 -0400
Received: from [10.36.116.67] (ovpn-116-67.ams2.redhat.com [10.36.116.67])
by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id q6CBopCY015726
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
for ; Thu, 12 Jul 2012 07:50:53 -0400
Message-ID: <4FFEBA1B.90804@draigBrady.com>
Date: Thu, 12 Jul 2012 12:50:51 +0100
From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?=
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
rv:6.0) Gecko/20110816 Thunderbird/6.0
MIME-Version: 1.0
To: Report bugs to
Subject: df doesn't handle \n in mount entries appropriately
X-Enigmail-Version: 1.3.2
Content-Type: text/plain; charset=UTF-8
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id
q6CBorWk013544
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.118.235.17
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Sender: debbugs-submit-bounces@debbugs.gnu.org
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
X-Spam-Score: -6.9 (------)
The edge case where '\n' is in any of the /proc/mounts fields,
will cause problems with errant new lines being output by `df`.
(I notice `findmnt` from util-linux too has the same issue).
So df uses getmntent(3) to get the list, and from its man page we have:
"Since fields in the mtab and fstab files are separated by whitespace,
octal escapes are used to represent the four characters space (\040),
tab (\011), newline (\012) and backslash (\134) in those files when
they occur in one of the four strings in a mntent structure. The rou=E2=
=80=90
tines addmntent() and getmntent() will convert from string representa=E2=
=80=90
tion to escaped representation and back."
So how to handle this. I don't think it's appropriate to
reapply all the escaping in -P mode (which explicitly wants to avoid
multiline entries), since scripts might already be
handling the more common cases of and .
So how about we just change \n -> \012.
This will at least improve the output for humans.
Scripts will not be able to directly use such entries,
but they couldn't anyway, and also processing of other
entries is no longer impacted.
Also `df` since coreutils 8.11 no longer wraps long lines,
preferring to expand alignment. This is easier to read
and avoids a common gotcha in scripts.
So even for non -P mode, we should do the \n -> \012 change.
It's tempting to do this transformation in read_file_system_list()
in gnulib, but that would cause that lib to output an ambiguous
format, and so it's probably best do the processing in each app
as required?
cheers,
P=C3=A1draig.
------------=_1342403583-15961-1--