From MAILER-DAEMON Thu May 04 16:16:42 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1d6NB4-0001uX-9q
	for mharc-coreutils@gnu.org; Thu, 04 May 2017 16:16:42 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:44191)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <egmont@gmail.com>) id 1d6N9G-0001iZ-SZ
	for coreutils@gnu.org; Thu, 04 May 2017 16:14:51 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <egmont@gmail.com>) id 1d6N9F-0005mx-UM
	for coreutils@gnu.org; Thu, 04 May 2017 16:14:50 -0400
Received: from mail-io0-x22a.google.com ([2607:f8b0:4001:c06::22a]:33733)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <egmont@gmail.com>) id 1d6N9F-0005lr-PT
	for coreutils@gnu.org; Thu, 04 May 2017 16:14:49 -0400
Received: by mail-io0-x22a.google.com with SMTP id p24so36720613ioi.0
	for <coreutils@gnu.org>; Thu, 04 May 2017 13:14:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:from:date:message-id:subject:to;
	bh=QpLY43rY56fnsN7pbOifC0QVdOcDD2sry9zgnOoVBcE=;
	b=RlpXS9w6u9iAjfQjAILLpZyKYKMkxuqjKyBPBtxiGy3B9J7u2mOQiJf2GNixnqjNEB
	ai/5N9xUeXITfKuAd258gU+7eoBFsBJPtLr4vDPAkxyHvo1DSKmrLuOHKks77f5B2osu
	RzsNaYS8cXgpgit7sNgn1mMucBPhRwZuqP+WSAIICZ5ouTIBoeJRfbGgGvQG0ezl/4V2
	NEtNntkWcngsGg7ep5f2m7X53XGRKYqVv7JInTcdyzOmBSkc3D2MSSlyvKAeMmAst7vP
	a0CECi1tXkOqgcVIN709LGr0BN77smP/GzqHljBpAcss6P7LCpn7o05AZ49UvFCrqXpn
	3fbA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
	bh=QpLY43rY56fnsN7pbOifC0QVdOcDD2sry9zgnOoVBcE=;
	b=YOpqvLRR4f0VPR6/jyZXxATw5Q1MKgm5V8GLphTmvBj+8T6yYlwZIKzjZ6VOinRUfT
	7UFp4WVScbJ3UgPeIRMtlfG3EkVTqkMaIGKIoXW3cQYEBcbQyxg3XWxKslems2TS2Di1
	HwAEbSEWcFTWzHVxfHJDw7O+p/U58QL42j8jro5lFPteD1kxXmhxtbBP6YfzQWP0vVNz
	PskAOlOiB2NMk4Ij1CBaR2BfZQ2fS843lfb2dcoZ+ZtCnhfaNrcifBPxsEecXA4Lgb0L
	LpyodJ/vGeyYsTLbkO92DRyPjd5Aw7JtTEZomXcxcmblAEFQKJEA2oK2NjLpywGMg///
	oHvA==
X-Gm-Message-State: AN3rC/5c/CymIup3iZu+d3WlsGwTojeekOcdZ0LxitlTgjBof/H4VjSO
	SVok/hjPXjmYwuWdO0ONRz6die2AiZmW
X-Received: by 10.107.48.144 with SMTP id w138mr46289534iow.30.1493928888740; 
	Thu, 04 May 2017 13:14:48 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.79.209.138 with HTTP; Thu, 4 May 2017 13:14:08 -0700 (PDT)
From: Egmont Koblinger <egmont@gmail.com>
Date: Thu, 4 May 2017 22:14:08 +0200
Message-ID: <CAGWcZk+z8gsuG=ARNbDj1-YDwinAc=ryWGvhSPg_uGGDC+QeYg@mail.gmail.com>
Subject: Feature request: ls --hyperlink
To: coreutils@gnu.org
Content-Type: text/plain; charset=UTF-8
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:4001:c06::22a
X-Mailman-Approved-At: Thu, 04 May 2017 16:16:41 -0400
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 04 May 2017 20:14:52 -0000

Hi,

Recently two popular terminal emulators, GNOME Terminal and iTerm2
have implemented a brand new feature: explicit hyperlinks.

Unlike the existing functionality of most terminal emulators of
automatically detecting URLs that appear on the screen, this time it's
like hyperlinks on web pages: the link target is specified by the OSC
8 escape sequence and the visible text can be an arbitrary piece of
text.

As I've played with this feature, I found a really compelling use
case: listing files in a way that all of them are hyperlinks to
"file://...". It makes it as easy and convenient as a Ctrl+click to
open them in their preferred graphical application.

(For even more fun, there's a pending demo patch to GNOME Terminal to
display a preview of certain local files on mouseover. We're uncertain
yet if we'll finalize and ship it or not.)

I've created a quick proof of concept patch for a new cmdline option
"ls --hyperlink=always/auto/never", have set it up in my "ls" alias,
and been using that happily for a few weeks now. Please find it at
https://bugzilla.gnome.org/show_bug.cgi?id=779734#c126. Note that it
contains a couple of issues, e.g. I forgot to free some data, and it
does stupid things around symlinks. As said, it's a demo, not a fully
polished patch.

I'd be curious to hear if you like this idea, and would be happy to
see this option appearing in mainstream coreutils.

Please see https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
for details about the feature.

Let me know if you have any questions, concerns etc. (cc me, I'm not
subscribed).

Thanks a lot,
egmont


From MAILER-DAEMON Fri May 05 17:05:54 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1d6kQD-0006Fp-VA
	for mharc-coreutils@gnu.org; Fri, 05 May 2017 17:05:53 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:38676)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <P@draigBrady.com>) id 1d6kQB-0006El-73
	for coreutils@gnu.org; Fri, 05 May 2017 17:05:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <P@draigBrady.com>) id 1d6kQ6-0000uS-Rb
	for coreutils@gnu.org; Fri, 05 May 2017 17:05:50 -0400
Received: from mail.magicbluesmoke.com ([82.195.144.49]:59192)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <P@draigBrady.com>) id 1d6kQ6-0000rF-M3
	for coreutils@gnu.org; Fri, 05 May 2017 17:05:46 -0400
Received: from localhost.localdomain (unknown [166.177.249.46])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by mail.magicbluesmoke.com (Postfix) with ESMTPSA id 0DA419985;
	Fri,  5 May 2017 22:05:40 +0100 (IST)
Subject: Re: Feature request: ls --hyperlink
To: Egmont Koblinger <egmont@gmail.com>, coreutils@gnu.org
References: <CAGWcZk+z8gsuG=ARNbDj1-YDwinAc=ryWGvhSPg_uGGDC+QeYg@mail.gmail.com>
From: =?UTF-8?Q?P=c3=a1draig_Brady?= <P@draigBrady.com>
Message-ID: <85963450-b32f-8b87-a708-5ca417882daa@draigBrady.com>
Date: Fri, 5 May 2017 14:05:38 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
	Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <CAGWcZk+z8gsuG=ARNbDj1-YDwinAc=ryWGvhSPg_uGGDC+QeYg@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 82.195.144.49
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 05 May 2017 21:05:52 -0000

On 04/05/17 13:14, Egmont Koblinger wrote:
> Hi,
>=20
> Recently two popular terminal emulators, GNOME Terminal and iTerm2
> have implemented a brand new feature: explicit hyperlinks.
>=20
> Unlike the existing functionality of most terminal emulators of
> automatically detecting URLs that appear on the screen, this time it's
> like hyperlinks on web pages: the link target is specified by the OSC
> 8 escape sequence and the visible text can be an arbitrary piece of
> text.
>=20
> As I've played with this feature, I found a really compelling use
> case: listing files in a way that all of them are hyperlinks to
> "file://...". It makes it as easy and convenient as a Ctrl+click to
> open them in their preferred graphical application.
>=20
> (For even more fun, there's a pending demo patch to GNOME Terminal to
> display a preview of certain local files on mouseover. We're uncertain
> yet if we'll finalize and ship it or not.)
>=20
> I've created a quick proof of concept patch for a new cmdline option
> "ls --hyperlink=3Dalways/auto/never", have set it up in my "ls" alias,
> and been using that happily for a few weeks now. Please find it at
> https://bugzilla.gnome.org/show_bug.cgi?id=3D779734#c126. Note that it
> contains a couple of issues, e.g. I forgot to free some data, and it
> does stupid things around symlinks. As said, it's a demo, not a fully
> polished patch.
>=20
> I'd be curious to hear if you like this idea, and would be happy to
> see this option appearing in mainstream coreutils.
>=20
> Please see https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3c=
b5feda
> for details about the feature.
>=20
> Let me know if you have any questions, concerns etc. (cc me, I'm not
> subscribed).

Interesting.
This could apply to any util really that displays file names,
though ls would be the most useful.
Generally it also seems useful to the case where a file has a non represe=
ntable name
(well not cleanly at least without $'shell quoting').

thanks,
P=C3=A1draig.


From MAILER-DAEMON Sun May 07 19:25:42 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1d7VYc-0007qO-JV
	for mharc-coreutils@gnu.org; Sun, 07 May 2017 19:25:42 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:58035)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <desiree.zahradnicek@gmail.com>) id 1d7V8O-0003df-Ns
	for coreutils@gnu.org; Sun, 07 May 2017 18:58:37 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <desiree.zahradnicek@gmail.com>) id 1d7V8O-00048L-3I
	for coreutils@gnu.org; Sun, 07 May 2017 18:58:36 -0400
Received: from mail-qk0-x233.google.com ([2607:f8b0:400d:c09::233]:34947)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <desiree.zahradnicek@gmail.com>)
	id 1d7V8N-00048E-V3
	for coreutils@gnu.org; Sun, 07 May 2017 18:58:36 -0400
Received: by mail-qk0-x233.google.com with SMTP id a72so23369053qkj.2
	for <coreutils@gnu.org>; Sun, 07 May 2017 15:58:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:from:date:message-id:subject:to
	:content-transfer-encoding;
	bh=ltk/u/cX9XgwTtGRUMMyUeciwdUzT8c6HpTpDfR335c=;
	b=uf1QQaD/BMnfmVhj9mHj7NfSrkTsr+BVUrJtmiJ6DUVl9SJZgCPe0/ThSY7xlxh5a6
	qeUJjQxaic5GTAvGvZ5HvMpK9P4sRytkTO+72zw0Giv6VM+OE9AM26SLW/hfNQdBBJSS
	hMrLFiGESK/05mxlsJk1RK8tFL+ul/NUnoNZjuWfMGnbLaAZhtCt8j2KmH9ErvM/PmL1
	+Tl9YSrohL1HHm90Nha3oWNubkBEt/uc/djzwwAvxi9tEgezygQ4QN3RUeL2nh2MWNhN
	YKq5FDJ6rMM6Rw/tpB3+me1e9sedhnv6KlREspvizJ6pAp0me4d9y7TVyejWNdRxR25+
	jSCQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:from:date:message-id:subject:to
	:content-transfer-encoding;
	bh=ltk/u/cX9XgwTtGRUMMyUeciwdUzT8c6HpTpDfR335c=;
	b=lXVACyZZDxKTG2yCXvx3e8YDHQsYtvDWRPSxIZ0aqztnLlf45MMRpv7xFUf4PucNtd
	FZgFbijk6WznxWoVBtT4prmiuwx2XgnzhvPKGlN1qtYtumEEQktMV63f5s/L2K3c+2vg
	5yPoDXKAr4m6SEnPhc1CotsL0iMGM41OBeWZ0DwbQtSiLY9Eza4f/bLq9AyG48tZUyFv
	46j8JH4Eob7rzTe4OQ00jjLk7BbvekvbORZNBbC+8YrOv6lq6VTyIgJu8QTqYBNVNEci
	gT8Wo9u9mC5PK2/5ZFCgzPVhZUcvR7pkIw7uEVkDI3Lo/i4BjQsvnHtUtwLpSx13zd3x
	6++g==
X-Gm-Message-State: AODbwcDpYZzAy/0ToZgsSJ3uE3DAxb3NKwbdrEs49fhXUpD3Hu8xbAe+
	D/YfKgzPx5QYuywCefx5pd5N6KfDs2s2
X-Received: by 10.55.78.15 with SMTP id c15mr25657539qkb.62.1494197914874;
	Sun, 07 May 2017 15:58:34 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.200.46.111 with HTTP; Sun, 7 May 2017 15:58:34 -0700 (PDT)
From: =?UTF-8?Q?Desir=C3=A9e_Zahradnicek?= <desiree.zahradnicek@gmail.com>
Date: Sun, 7 May 2017 19:58:34 -0300
Message-ID: <CAKid7fa=1iLuS8EdBJwhoFQ0tQ9D8SVuoNM_Wme7tf3-TPbBfg@mail.gmail.com>
Subject: Student contribution
To: coreutils@gnu.org
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:400d:c09::233
X-Mailman-Approved-At: Sun, 07 May 2017 19:25:41 -0400
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 07 May 2017 22:58:37 -0000

Hi, mi name is Desir=C3=A9e Zahradnicek and I'm in the last year of
Information Systems Engineering. As a requirement for subject called
Free Software I have to make a contribution to a free software
project, and I thought about contributing to coreutils.
I have a small but useful idea in mind, I'm thinking about adding an
option to the program "tail" to make it print the last lines of a file
filling the terminal height. I think this could be very useful on its
own and more so in combination with watch. I created a really small
shell script to emulate the functionality:

#!/bin/bash
nlines=3D$(( $(tput lines) - 2 ))
tail -$nlines $1

I'm writing to ask if you think this could be included so I can start
to work on it.

Thanks in advance,
Desir=C3=A9e Zahradnicek


From MAILER-DAEMON Mon May 08 08:08:59 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1d7hTH-0007d0-Rf
	for mharc-coreutils@gnu.org; Mon, 08 May 2017 08:08:59 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:57009)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <P@draigBrady.com>) id 1d7hTG-0007cu-C4
	for coreutils@gnu.org; Mon, 08 May 2017 08:08:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <P@draigBrady.com>) id 1d7hTD-0000ps-4p
	for coreutils@gnu.org; Mon, 08 May 2017 08:08:58 -0400
Received: from mail.magicbluesmoke.com ([82.195.144.49]:56418)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <P@draigBrady.com>) id 1d7hTC-0000kp-V8
	for coreutils@gnu.org; Mon, 08 May 2017 08:08:55 -0400
Received: from localhost.localdomain (unknown [109.77.106.137])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by mail.magicbluesmoke.com (Postfix) with ESMTPSA id 76D584AC3;
	Mon,  8 May 2017 13:08:50 +0100 (IST)
Subject: Re: Student contribution
To: =?UTF-8?Q?Desir=c3=a9e_Zahradnicek?= <desiree.zahradnicek@gmail.com>,
	Coreutils <coreutils@gnu.org>
References: <CAKid7fa=1iLuS8EdBJwhoFQ0tQ9D8SVuoNM_Wme7tf3-TPbBfg@mail.gmail.com>
From: =?UTF-8?Q?P=c3=a1draig_Brady?= <P@draigBrady.com>
Message-ID: <1f8c9fce-b99e-2c2d-0c75-fb2dabdc0e9f@draigBrady.com>
Date: Mon, 8 May 2017 05:08:49 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
	Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <CAKid7fa=1iLuS8EdBJwhoFQ0tQ9D8SVuoNM_Wme7tf3-TPbBfg@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 82.195.144.49
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 08 May 2017 12:08:59 -0000

On 07/05/17 15:58, Desir=C3=A9e Zahradnicek wrote:
> Hi, mi name is Desir=C3=A9e Zahradnicek and I'm in the last year of
> Information Systems Engineering. As a requirement for subject called
> Free Software I have to make a contribution to a free software
> project, and I thought about contributing to coreutils.
> I have a small but useful idea in mind, I'm thinking about adding an
> option to the program "tail" to make it print the last lines of a file
> filling the terminal height. I think this could be very useful on its
> own and more so in combination with watch. I created a really small
> shell script to emulate the functionality:
>=20
> #!/bin/bash
> nlines=3D$(( $(tput lines) - 2 ))
> tail -$nlines $1
>=20
> I'm writing to ask if you think this could be included so I can start
> to work on it.

Thanks for considering coreutils!
As for this particular functionality, it definitely _is_ useful.
I myself use this alias:

  alias tail=3D'tail -n $((${LINES:-12}-2))'

However considering the relatively simple alias to achieve this functiona=
lity
it's probably better to not couple that within tail itself.

Would you perhaps consider some other coreutils patch?
For example it would be useful for `sort --debug` to print extra info.
 1. print memory space available.
   I.E. allocated internal buffer sizes and space avail at $TMPDIR(s)
 2. output if locale is specific to the sort.
   I.E. if strcoll() and memcmp() differ in direction

cheers,
P=C3=A1draig.


From MAILER-DAEMON Tue May 09 09:41:07 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1d85Nz-0006pp-NC
	for mharc-coreutils@gnu.org; Tue, 09 May 2017 09:41:07 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:34175)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <reuti@staff.uni-marburg.de>) id 1d85Nu-0006pQ-Kj
	for coreutils@gnu.org; Tue, 09 May 2017 09:41:06 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <reuti@staff.uni-marburg.de>) id 1d85Nq-000529-5s
	for coreutils@gnu.org; Tue, 09 May 2017 09:41:02 -0400
Received: from vhrz24.hrz.uni-marburg.de ([137.248.1.34]:51137)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <reuti@staff.uni-marburg.de>)
	id 1d85Np-00051L-TG
	for coreutils@gnu.org; Tue, 09 May 2017 09:40:58 -0400
Received: from ma15106.chemie.uni-marburg.de (ma15106.Chemie.Uni-Marburg.DE
	[137.248.150.142]) (authenticated bits=0)
	by vhrz24.HRZ.Uni-Marburg.DE (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP
	id v49Dehtx060229
	(version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT)
	for <coreutils@gnu.org>; Tue, 9 May 2017 15:40:45 +0200
From: Reuti <reuti@staff.uni-marburg.de>
Subject: Coloring of unreachable symbolic links
Message-Id: <C71D9CD2-A17B-437D-AA14-CDA8DC8770BE@staff.uni-marburg.de>
Date: Tue, 9 May 2017 15:40:43 +0200
To: coreutils@gnu.org
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\))
X-Mailer: Apple Mail (2.2104)
X-Null-Tag: 6c5c3572cca7a6d7c810fb19bd1dd7a6
X-UniMR-MailScanner-Information: see
	http://www.uni-marburg.de/hrz/internet/mail/spam/
X-UniMR-MailScanner-ID: v49Dehtx060229
X-UniMR-MailScanner: Found to be clean
X-UniMR-MailScanner-From: reuti@staff.uni-marburg.de
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 137.248.1.34
Content-Type: text/plain;
	charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 09 May 2017 13:41:06 -0000

Hi,

I was confused by the output of `ls` (coreutils 8.27) and the non =
corresponding behavior when trying to access some files. Essentially it =
was a set fs.protected_symlinks=3D1 which was the reason, but the =
coloring in `ls` did not reflect it.

Looking into this, I found that `ls` on it's own uses cyan on white for =
symlinks, whether they are valid and sensible or not. Using `dircolors` =
beforehand to set LS_COLORS shows orphaned symbolic links with red on =
black by setting a value for "or=3D40;31;01".

In a directory with the "sticky bit set" and enabled =
"fs.protected_symlinks=3D1", I got this as user "foo":

-rw-r--r--  1 soft     users       0 May  9 14:17 uuu
lrwxrwxrwx  1 soft     users       3 May  9 14:18 vvv -> uuu
lrwxrwxrwx  1 soft     users       3 May  9 14:39 www -> vvv

Any user "foo" belonging to group "users" can access the file "uuu" to =
list it (black on white is ok). But he can't use the symbolic link =
"vvv", nevertheless it is listed as (cyan on white). On the other hand, =
the symbolic link "www" is shown as (red on black) as the target "vvv" =
can't be reached.

I can use -L and both symbolic links appear in (red on black).

Question: why is "vvv" still printed in (cyan on white) by default, =
although it can't be reached?

-- Reuti

PS: I can use 'dircolors --print-database' to show all settings, but =
where are the codes for setting "or=3D..." and alike are documented?=

From MAILER-DAEMON Wed May 10 05:14:37 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1d8Nhd-00071A-Hu
	for mharc-coreutils@gnu.org; Wed, 10 May 2017 05:14:37 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:55780)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <reuti@staff.uni-marburg.de>) id 1d8Nhb-000710-JH
	for coreutils@gnu.org; Wed, 10 May 2017 05:14:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <reuti@staff.uni-marburg.de>) id 1d8NhX-0002Fa-F7
	for coreutils@gnu.org; Wed, 10 May 2017 05:14:35 -0400
Received: from vhrz24.hrz.uni-marburg.de ([137.248.1.34]:53930)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <reuti@staff.uni-marburg.de>)
	id 1d8NhX-0002FH-7H
	for coreutils@gnu.org; Wed, 10 May 2017 05:14:31 -0400
Received: from ma15106.chemie.uni-marburg.de (ma15106.Chemie.Uni-Marburg.DE
	[137.248.150.142]) (authenticated bits=0)
	by vhrz24.HRZ.Uni-Marburg.DE (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP
	id v4A9EJZt022103
	(version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT)
	for <coreutils@gnu.org>; Wed, 10 May 2017 11:14:19 +0200
Content-Type: multipart/signed;
	boundary="Apple-Mail=_776D80B4-AE86-4D1E-B674-4044D2237973";
	protocol="application/pgp-signature"; micalg=pgp-sha1
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\))
Subject: Re: Coloring of unreachable symbolic links
X-Pgp-Agent: GPGMail
From: Reuti <reuti@staff.uni-marburg.de>
In-Reply-To: <C71D9CD2-A17B-437D-AA14-CDA8DC8770BE@staff.uni-marburg.de>
Date: Wed, 10 May 2017 11:14:18 +0200
Message-Id: <CC9C5D36-4B26-41BF-AAC6-3D4F66FD99FB@staff.uni-marburg.de>
References: <C71D9CD2-A17B-437D-AA14-CDA8DC8770BE@staff.uni-marburg.de>
To: coreutils@gnu.org
X-Mailer: Apple Mail (2.2104)
X-Null-Tag: d5755c2e942037b42d7a4cf0fa25ae66
X-UniMR-MailScanner-Information: see
	http://www.uni-marburg.de/hrz/internet/mail/spam/
X-UniMR-MailScanner-ID: v4A9EJZt022103
X-UniMR-MailScanner: Found to be clean
X-UniMR-MailScanner-From: reuti@staff.uni-marburg.de
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 137.248.1.34
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 10 May 2017 09:14:36 -0000


--Apple-Mail=_776D80B4-AE86-4D1E-B674-4044D2237973
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Hi again,

> Am 09.05.2017 um 15:40 schrieb Reuti <reuti@staff.uni-marburg.de>:
>=20
> Hi,
>=20
> I was confused by the output of `ls` (coreutils 8.27) and the non =
corresponding behavior when trying to access some files. Essentially it =
was a set fs.protected_symlinks=3D1 which was the reason, but the =
coloring in `ls` did not reflect it.
>=20
> Looking into this, I found that `ls` on it's own uses cyan on white =
for symlinks, whether they are valid and sensible or not. Using =
`dircolors` beforehand to set LS_COLORS shows orphaned symbolic links =
with red on black by setting a value for "or=3D40;31;01".
>=20
> In a directory with the "sticky bit set" and enabled =
"fs.protected_symlinks=3D1", I got this as user "foo":
>=20
> -rw-r--r--  1 soft     users       0 May  9 14:17 uuu
> lrwxrwxrwx  1 soft     users       3 May  9 14:18 vvv -> uuu
> lrwxrwxrwx  1 soft     users       3 May  9 14:39 www -> vvv
>=20
> Any user "foo" belonging to group "users" can access the file "uuu" to =
list it (black on white is ok). But he can't use the symbolic link =
"vvv", nevertheless it is listed as (cyan on white). On the other hand, =
the symbolic link "www" is shown as (red on black) as the target "vvv" =
can't be reached.
>=20
> I can use -L and both symbolic links appear in (red on black).
>=20
> Question: why is "vvv" still printed in (cyan on white) by default, =
although it can't be reached?

Thinking about this issue and avoiding any ambiguousness: it would even =
be better when this state gets a coloring on its own like (red on gray) =
for "denied symbolic link, while the target exists", being it "de=3D", =
"ds=3D" or "dl". Both symbolic links in the example should get this =
color.

I assume that for now `ls` checks whether the target of a symbolic link =
can be accessed, even without using the symbolic link itself. This would =
explain, why "vvv" is (cyan on white), although it can't be used.

-- Reuti

--Apple-Mail=_776D80B4-AE86-4D1E-B674-4044D2237973
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iEYEARECAAYFAlkS2esACgkQo/GbGkBRnRo+JACglLqkLPbgkIoqjCYPMohPN2nJ
GOwAn1w6KT/Nrfecy+t2CEQLV6FW9NLC
=qyQH
-----END PGP SIGNATURE-----

--Apple-Mail=_776D80B4-AE86-4D1E-B674-4044D2237973--


From MAILER-DAEMON Wed May 10 18:49:24 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1d8aQ8-0000Dm-95
	for mharc-coreutils@gnu.org; Wed, 10 May 2017 18:49:24 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:57953)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <selk@dragora.org>) id 1d8aQ6-0000Df-Gp
	for coreutils@gnu.org; Wed, 10 May 2017 18:49:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <selk@dragora.org>) id 1d8aQ1-00073d-Lx
	for coreutils@gnu.org; Wed, 10 May 2017 18:49:22 -0400
Received: from dragora.org ([69.61.93.52]:46860 helo=mail.dragora.org)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <selk@dragora.org>) id 1d8aQ1-00072w-Hi
	for coreutils@gnu.org; Wed, 10 May 2017 18:49:17 -0400
Received: from rafaela (unknown [200.3.217.24])
	by mail.dragora.org (Postfix) with ESMTPSA id 227793420C7
	for <coreutils@gnu.org>; Wed, 10 May 2017 22:47:39 +0000 (UTC)
Date: Wed, 10 May 2017 19:49:08 -0300
From: Matias Fonzo <selk@dragora.org>
To: Coreutils <coreutils@gnu.org>
Subject: doubt about sync(1) for shutdown the system
Message-ID: <20170510194908.54c53b73@rafaela>
Organization: Dragora GNU/Linux-Libre
X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.10; x86_64-dragora-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
	boundary="Sig_/jsuBgS7UbVBQosllbRg6CyD";
	protocol="application/pgp-signature"
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 69.61.93.52
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 10 May 2017 22:49:23 -0000

--Sig_/jsuBgS7UbVBQosllbRg6CyD
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Hi there,

I am writing a shutdown script for the boot process.

I have a little question, which is exactly the order to apply correctly
sync(1)?:

  1. Before to unmount swap devices, local/remote filesystems?.

  2. Between the unmount of swap device(s) and local/remote
  file systems?.

  3. After to unmount everything?.

  4. ... ?.

Thanks,
Matias


--Sig_/jsuBgS7UbVBQosllbRg6CyD
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQJ8BAEBCgBmBQJZE5jkXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQzNUJEQjlENDZCNTZCNUZBQ0I2NDdDOUIz
QUFGMUNFQzIwM0E5OUQ1AAoJEDqvHOwgOpnVXKIP/ixX+WRRMQz5ti5AS6GlzL6f
xLRq61XIvLbg9hWYrc7TRG9L4eJomxDn2upmMnmW1XyrInNilG0pra9cZlc5VWdH
dr2y0LsvkO+6DyEzf8xPtA88IXNTyKgzoyh47vCiTuO2mHiQpCX+BXdMGjdpustS
qNJkEyod3ChGJQOlCi5whJDSu9wbUwwyeySqKN2EX4AC8XsfwWZIA1Nt9GZXgeuC
HpOeyt2VVOSkGlgqkUGGlm6elAdBj7UevG4/HzgOKMCerdsztTUUJ6kI0tWCW4uC
HPEM14UdPX8YxOAXwTDfWrPZGLV9XrMxnbtIcuYDvxR7dzHGLwZXmHHnKLiYC49U
VUFT9tfzykD5qxNotqhZmhMj3GRX06jzYUUv5tVANrvrH6VEMvWDFjffeVjvkUP+
HJZnuoJwan1VRgQZHQjUtSxpIy9KQZWR07lJTEDh6cWPsubpOwYqeZvEORdZxFRK
u0XGa4xIN2n7+ZTPcet7byyASjapXW/uNhvRqU95Zpr30HTlmQJMn7jVffgF5hCP
hyYJ/np/6iYxcalMVM9S5pt0GWXUqoB3qDzbBhLvGCdZoILVUngeKTQ5+Lzrsxj8
QnqQr9C9NMoPwC0zoWIlowup0RgzgZQ+Es9YEr3aGKPtQoFBiBV5AMmgx1hLx+YI
IDuKHKztcnMw+u/Rwzxr
=HPKf
-----END PGP SIGNATURE-----

--Sig_/jsuBgS7UbVBQosllbRg6CyD--


From MAILER-DAEMON Wed May 10 19:06:59 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1d8ah9-0002fl-OQ
	for mharc-coreutils@gnu.org; Wed, 10 May 2017 19:06:59 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:36836)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <desiree.zahradnicek@gmail.com>) id 1d8ah7-0002fb-BF
	for coreutils@gnu.org; Wed, 10 May 2017 19:06:58 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <desiree.zahradnicek@gmail.com>) id 1d8ah6-0000pa-8t
	for coreutils@gnu.org; Wed, 10 May 2017 19:06:57 -0400
Received: from mail-qk0-x236.google.com ([2607:f8b0:400d:c09::236]:35372)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <desiree.zahradnicek@gmail.com>)
	id 1d8ah6-0000pM-4w
	for coreutils@gnu.org; Wed, 10 May 2017 19:06:56 -0400
Received: by mail-qk0-x236.google.com with SMTP id a72so9259335qkj.2
	for <coreutils@gnu.org>; Wed, 10 May 2017 16:06:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:content-transfer-encoding;
	bh=sZ+eDTC/CU5YS8Si1KwyIT4ymGM534DGkdCJ3T1obt8=;
	b=gpvXPdXsUtfZqxUbXBAuDm1K3fjDjnsu1U53jepDsPMGq/yRXO57V7yJtB81oW6iQ3
	ryZw3bfWaRvdXPuIexWnvq9cXdlgFRNq+yBVzb85idHQkAKfOM8FhijO4WLtY2Int96M
	TnyftnhirzugMN74TODzmeZUnB0UmVaQKBr1UCrrX5j7t5UnNPNoZUL2KN5cd75grOWI
	FCgFycrPxfaANvCXUgr3qO88mJSBFzv3aIHPw/QJn1lpsxYQobK+bR8qbFIVl0DVsrrp
	YoZmhGDSKqO18aSxR2dmhA4OPOK1No/vzz2cOZwv/prRJrIN4UlrIOZK9txy1RrLXh7s
	4fxQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:content-transfer-encoding;
	bh=sZ+eDTC/CU5YS8Si1KwyIT4ymGM534DGkdCJ3T1obt8=;
	b=X6hinOST/lSFwblzTI3KIZBtHIqsZvoCmz1C+4/rAshumh19kVB7OyC9T+SGgysS6g
	ecRULGqkrUFLOScjxYd9zS3BCe3+qkKbIzNdNfFKdqGWALjJS7KSzugZAAycnVjnjvPR
	jghv4Ft7XTvYdYiDnt97GFcZEtEEhXUEcPcyJpSyiJNkMnjWXeKJiV7IWLBg6VfNPwhS
	Ll5KiGqC8aL4kWIlRegmIFhsBYQSwbSNWQQiriDUfmNejcsHJ6bU0HrYUqhMyQ81Vutj
	ZYhkBPTRPl60nmjRdcfXuJtgm0jLa6LnLdsxbzaBVHDiSeD3/tgvKg+obLCou3mREMea
	vYfg==
X-Gm-Message-State: AODbwcBpzT+Owag9vngIEAIDd8WA7uFypBUWVyDF1h4WJH5ayBirVoTb
	JkClokyoP/gNDyBMu8qRBE3JFPK+hg==
X-Received: by 10.55.158.16 with SMTP id h16mr7478393qke.300.1494457615488;
	Wed, 10 May 2017 16:06:55 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.200.46.111 with HTTP; Wed, 10 May 2017 16:06:55 -0700 (PDT)
In-Reply-To: <1f8c9fce-b99e-2c2d-0c75-fb2dabdc0e9f@draigBrady.com>
References: <CAKid7fa=1iLuS8EdBJwhoFQ0tQ9D8SVuoNM_Wme7tf3-TPbBfg@mail.gmail.com>
	<1f8c9fce-b99e-2c2d-0c75-fb2dabdc0e9f@draigBrady.com>
From: =?UTF-8?Q?Desir=C3=A9e_Zahradnicek?= <desiree.zahradnicek@gmail.com>
Date: Wed, 10 May 2017 20:06:55 -0300
Message-ID: <CAKid7fYGvzsBH23nUOzPB9Lpvd+9j0KQfqQ5PoNTMTXL6P+_8g@mail.gmail.com>
Subject: Re: Student contribution
To: =?UTF-8?Q?P=C3=A1draig_Brady?= <P@draigbrady.com>, 
	Coreutils <coreutils@gnu.org>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:400d:c09::236
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 10 May 2017 23:06:58 -0000

It's true that this functionality can be achieved very easily with a
simple script, but the point is that it being so useful it's a letdown
that it isn't incorporated already, and so people that needs it have
to go creating/googling a solution. I know it's much more work to have
it built in, and that as with all modifications there's always the
risk of breaking something, but on the plus side I'll be the one doing
the work, and as it adds an optional functionality it's not expected
to cause trouble if not used.

What do you say, do we give it a shot?

2017-05-08 9:08 GMT-03:00 P=C3=A1draig Brady <P@draigbrady.com>:
> On 07/05/17 15:58, Desir=C3=A9e Zahradnicek wrote:
>> Hi, mi name is Desir=C3=A9e Zahradnicek and I'm in the last year of
>> Information Systems Engineering. As a requirement for subject called
>> Free Software I have to make a contribution to a free software
>> project, and I thought about contributing to coreutils.
>> I have a small but useful idea in mind, I'm thinking about adding an
>> option to the program "tail" to make it print the last lines of a file
>> filling the terminal height. I think this could be very useful on its
>> own and more so in combination with watch. I created a really small
>> shell script to emulate the functionality:
>>
>> #!/bin/bash
>> nlines=3D$(( $(tput lines) - 2 ))
>> tail -$nlines $1
>>
>> I'm writing to ask if you think this could be included so I can start
>> to work on it.
>
> Thanks for considering coreutils!
> As for this particular functionality, it definitely _is_ useful.
> I myself use this alias:
>
>   alias tail=3D'tail -n $((${LINES:-12}-2))'
>
> However considering the relatively simple alias to achieve this functiona=
lity
> it's probably better to not couple that within tail itself.
>
> Would you perhaps consider some other coreutils patch?
> For example it would be useful for `sort --debug` to print extra info.
>  1. print memory space available.
>    I.E. allocated internal buffer sizes and space avail at $TMPDIR(s)
>  2. output if locale is specific to the sort.
>    I.E. if strcoll() and memcmp() differ in direction
>
> cheers,
> P=C3=A1draig.


From MAILER-DAEMON Wed May 10 19:44:30 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1d8bHS-0007u5-Cy
	for mharc-coreutils@gnu.org; Wed, 10 May 2017 19:44:30 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:49391)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dualbus@gmail.com>) id 1d8bHR-0007tw-0C
	for coreutils@gnu.org; Wed, 10 May 2017 19:44:29 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dualbus@gmail.com>) id 1d8bHQ-0004Gq-7u
	for coreutils@gnu.org; Wed, 10 May 2017 19:44:29 -0400
Received: from mail-io0-x22e.google.com ([2607:f8b0:4001:c06::22e]:33185)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <dualbus@gmail.com>) id 1d8bHQ-0004FV-2w
	for coreutils@gnu.org; Wed, 10 May 2017 19:44:28 -0400
Received: by mail-io0-x22e.google.com with SMTP id p24so11719442ioi.0
	for <coreutils@gnu.org>; Wed, 10 May 2017 16:44:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-transfer-encoding;
	bh=gTArCQxFakLjqbg2llX7bWwmlqtgmqFP0kC5HeY21Vg=;
	b=O9AbOZt3lVPo4U3gDhbfqueX2cNUIE+ByamVaXXishDG4+Ng+EVZjY4uW/UyO4t3Ax
	42Qeg9NtXnDBGw5LgsdNeEOe5TDpe4jecWmz5vncyN65qrNZF/r5tJf3ZgNDdEpdLDwI
	Wv52UYyXkEYC7hjb+RSuU3WfVOLH6M2xMZoQNuEzQFxR5TDqeedSifm532ZXqhbgUNXh
	m14iPKcmA1475dLTpAABcHj+mq1HWDOaOagJLGl7UElOIycxV/w85mLJnEuMIspo3pw6
	R7SANm5y962xtFWevRqVzDmckf8iS0hLuxKP1lHuJ3M2LewuDEILXZz2Xre+4YNUlV3/
	bb9A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:cc:content-transfer-encoding;
	bh=gTArCQxFakLjqbg2llX7bWwmlqtgmqFP0kC5HeY21Vg=;
	b=ULffU70Q9BPsFCMeDCmADc6sT4MAlbizCljtFqG6FcZmGkYAojbk3mNai1nHJ5wS/Q
	yYwg2olywlz+dBedPyL1c8HaNh8aefBxTkcE5YNgQAIUCqlJQQ4nnWxTZsrw33q31SK1
	BZlnSsqqOcPC3XUUSj5fsoo58WwlVo1jdWKOtwtSSU+Q0VwRUdxeC/YPOrUEBekVIlcq
	F45YaR++3ghP/5F478HwDdwhWyRhI6S6lTVvT9GtNr2vt83O+RWi/QGiED/R9+7xgWJ5
	56AdnwP2EL/J3lQIXBgjIc2PBApnNgH1u8YN/QImn0VvkLeekhKoIamR6Ka2OnhRuVqr
	ZNpw==
X-Gm-Message-State: AODbwcBx4NoFdWQ7PkVHVnBLxdXaB4ACoqFRxHA2NWb6VkmUTKoMdigg
	apOfejelBIZqMka/RCLHHTVbUGeI7w==
X-Received: by 10.107.35.75 with SMTP id j72mr5834161ioj.180.1494459866675;
	Wed, 10 May 2017 16:44:26 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.50.96.168 with HTTP; Wed, 10 May 2017 16:44:06 -0700 (PDT)
In-Reply-To: <CAKid7fYGvzsBH23nUOzPB9Lpvd+9j0KQfqQ5PoNTMTXL6P+_8g@mail.gmail.com>
References: <CAKid7fa=1iLuS8EdBJwhoFQ0tQ9D8SVuoNM_Wme7tf3-TPbBfg@mail.gmail.com>
	<1f8c9fce-b99e-2c2d-0c75-fb2dabdc0e9f@draigBrady.com>
	<CAKid7fYGvzsBH23nUOzPB9Lpvd+9j0KQfqQ5PoNTMTXL6P+_8g@mail.gmail.com>
From: Eduardo Bustamante <dualbus@gmail.com>
Date: Wed, 10 May 2017 18:44:06 -0500
Message-ID: <CAOSMAusn032wPFRFz=u=_Qu1rZdb3wQgi5QuJ-k3cpiX0WaA=A@mail.gmail.com>
Subject: Re: Student contribution
To: =?UTF-8?Q?Desir=C3=A9e_Zahradnicek?= <desiree.zahradnicek@gmail.com>
Cc: =?UTF-8?Q?P=C3=A1draig_Brady?= <P@draigbrady.com>, 
	Coreutils <coreutils@gnu.org>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:4001:c06::22e
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 10 May 2017 23:44:29 -0000

On Wed, May 10, 2017 at 6:06 PM, Desir=C3=A9e Zahradnicek
<desiree.zahradnicek@gmail.com> wrote:
> It's true that this functionality can be achieved very easily with a
> simple script, but the point is that it being so useful it's a letdown
> that it isn't incorporated already, and so people that needs it have
> to go creating/googling a solution. I know it's much more work to have
> it built in, and that as with all modifications there's always the
> risk of breaking something, but on the plus side I'll be the one doing
> the work, and as it adds an optional functionality it's not expected
> to cause trouble if not used.

Consider software bloat. If you can fulfill the requirement with a
2-line script, then perhaps it's not something that *needs* to be
implemented in the tail utility.

"Write programs that do one thing and do it well. Write programs to
work together. Write programs to handle text streams, because that is
a universal interface." -- Doug McIlroy


From MAILER-DAEMON Wed May 10 19:56:57 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1d8bTV-0001uO-0E
	for mharc-coreutils@gnu.org; Wed, 10 May 2017 19:56:57 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:54282)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <P@draigBrady.com>) id 1d8bTT-0001uD-CQ
	for coreutils@gnu.org; Wed, 10 May 2017 19:56:56 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <P@draigBrady.com>) id 1d8bTP-0002Hr-FN
	for coreutils@gnu.org; Wed, 10 May 2017 19:56:55 -0400
Received: from mail.magicbluesmoke.com ([82.195.144.49]:43562)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <P@draigBrady.com>) id 1d8bTP-0002Gn-7p
	for coreutils@gnu.org; Wed, 10 May 2017 19:56:51 -0400
Received: from localhost.localdomain (unknown [109.79.110.175])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by mail.magicbluesmoke.com (Postfix) with ESMTPSA id A30294A6B;
	Thu, 11 May 2017 00:56:46 +0100 (IST)
Subject: Re: Student contribution
To: =?UTF-8?Q?Desir=c3=a9e_Zahradnicek?= <desiree.zahradnicek@gmail.com>,
	Coreutils <coreutils@gnu.org>
References: <CAKid7fa=1iLuS8EdBJwhoFQ0tQ9D8SVuoNM_Wme7tf3-TPbBfg@mail.gmail.com>
	<1f8c9fce-b99e-2c2d-0c75-fb2dabdc0e9f@draigBrady.com>
	<CAKid7fYGvzsBH23nUOzPB9Lpvd+9j0KQfqQ5PoNTMTXL6P+_8g@mail.gmail.com>
From: =?UTF-8?Q?P=c3=a1draig_Brady?= <P@draigBrady.com>
Message-ID: <8dd8b2da-ec0a-ac2b-7623-31d5f9f15537@draigBrady.com>
Date: Wed, 10 May 2017 16:56:46 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
	Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <CAKid7fYGvzsBH23nUOzPB9Lpvd+9j0KQfqQ5PoNTMTXL6P+_8g@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 82.195.144.49
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 10 May 2017 23:56:56 -0000

On 10/05/17 16:06, Desir=C3=A9e Zahradnicek wrote:
> 2017-05-08 9:08 GMT-03:00 P=C3=A1draig Brady <P@draigbrady.com>:
>> On 07/05/17 15:58, Desir=C3=A9e Zahradnicek wrote:
>>> Hi, mi name is Desir=C3=A9e Zahradnicek and I'm in the last year of
>>> Information Systems Engineering. As a requirement for subject called
>>> Free Software I have to make a contribution to a free software
>>> project, and I thought about contributing to coreutils.
>>> I have a small but useful idea in mind, I'm thinking about adding an
>>> option to the program "tail" to make it print the last lines of a fil=
e
>>> filling the terminal height. I think this could be very useful on its
>>> own and more so in combination with watch. I created a really small
>>> shell script to emulate the functionality:
>>>
>>> #!/bin/bash
>>> nlines=3D$(( $(tput lines) - 2 ))
>>> tail -$nlines $1
>>>
>>> I'm writing to ask if you think this could be included so I can start
>>> to work on it.
>>
>> Thanks for considering coreutils!
>> As for this particular functionality, it definitely _is_ useful.
>> I myself use this alias:
>>
>>   alias tail=3D'tail -n $((${LINES:-12}-2))'
>>
>> However considering the relatively simple alias to achieve this functi=
onality
>> it's probably better to not couple that within tail itself.
>>
>> Would you perhaps consider some other coreutils patch?
>> For example it would be useful for `sort --debug` to print extra info.
>>  1. print memory space available.
>>    I.E. allocated internal buffer sizes and space avail at $TMPDIR(s)
>>  2. output if locale is specific to the sort.
>>    I.E. if strcoll() and memcmp() differ in direction
>>
>=20
> It's true that this functionality can be achieved very easily with a
> simple script, but the point is that it being so useful it's a letdown
> that it isn't incorporated already, and so people that needs it have
> to go creating/googling a solution. I know it's much more work to have
> it built in, and that as with all modifications there's always the
> risk of breaking something, but on the plus side I'll be the one doing
> the work, and as it adds an optional functionality it's not expected
> to cause trouble if not used.
>
> What do you say, do we give it a shot?

Well if you did you'd also have to add the option to head(1) for consiste=
ncy.
So with two commands getting extra options it starts to look a bit
less enticing. Those options have to be documented thus complicating
the docs for users, and if used with older versions of head/tail will fai=
l.
Also these options are tending more towards user preference config
rather than once off functionality selection, and thus would probably
be mostly used in aliases anyway.
Given the functionality can be achieved with a simple standard shell
alias/function, I'm still not convinced it's needed, and I'm
currently 60:40 against adding it.

thanks,
P=C3=A1draig


From MAILER-DAEMON Wed May 10 20:17:26 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1d8bnK-0005eA-60
	for mharc-coreutils@gnu.org; Wed, 10 May 2017 20:17:26 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:35611)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <P@draigBrady.com>) id 1d8bnI-0005cF-7F
	for coreutils@gnu.org; Wed, 10 May 2017 20:17:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <P@draigBrady.com>) id 1d8bnD-0005v3-6g
	for coreutils@gnu.org; Wed, 10 May 2017 20:17:24 -0400
Received: from mail.magicbluesmoke.com ([82.195.144.49]:43608)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <P@draigBrady.com>) id 1d8bnD-0005tp-0l
	for coreutils@gnu.org; Wed, 10 May 2017 20:17:19 -0400
Received: from localhost.localdomain (unknown [109.79.110.175])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by mail.magicbluesmoke.com (Postfix) with ESMTPSA id B8D35EB;
	Thu, 11 May 2017 01:17:16 +0100 (IST)
Subject: Re: doubt about sync(1) for shutdown the system
To: Matias Fonzo <selk@dragora.org>, Coreutils <coreutils@gnu.org>
References: <20170510194908.54c53b73@rafaela>
From: =?UTF-8?Q?P=c3=a1draig_Brady?= <P@draigBrady.com>
Message-ID: <3d910491-5656-91c8-7794-58be3134342f@draigBrady.com>
Date: Wed, 10 May 2017 17:17:16 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
	Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <20170510194908.54c53b73@rafaela>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 82.195.144.49
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 11 May 2017 00:17:25 -0000

On 10/05/17 15:49, Matias Fonzo wrote:
> Hi there,
>=20
> I am writing a shutdown script for the boot process.
>=20
> I have a little question, which is exactly the order to apply correctly
> sync(1)?:
>=20
>   1. Before to unmount swap devices, local/remote filesystems?.
>=20
>   2. Between the unmount of swap device(s) and local/remote
>   file systems?.
>=20
>   3. After to unmount everything?.
>=20
>   4. ... ?.
>=20
> Thanks,
> Matias
>=20

Note sync(1) doesn't return any errors from sync(2)
as the later always "succeeds".
Also syncing is implicit in umount.
Hence on modern systems calling sync(1) is IMHO redundant
if doing a umount anyway.
Consider also data written after the sync and before the umount.
Therefore the kernel umount is the only place that can
do that appropriate syncing without races.

cheers,
P=E1draig


From MAILER-DAEMON Wed May 10 20:35:35 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1d8c4t-0000Es-5Z
	for mharc-coreutils@gnu.org; Wed, 10 May 2017 20:35:35 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:48202)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <selk@dragora.org>) id 1d8c4r-0000El-59
	for coreutils@gnu.org; Wed, 10 May 2017 20:35:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <selk@dragora.org>) id 1d8c4n-00006B-67
	for coreutils@gnu.org; Wed, 10 May 2017 20:35:33 -0400
Received: from dragora.org ([69.61.93.52]:46866 helo=mail.dragora.org)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <selk@dragora.org>) id 1d8c4n-00005s-1V
	for coreutils@gnu.org; Wed, 10 May 2017 20:35:29 -0400
Received: from rafaela (unknown [200.3.217.24])
	by mail.dragora.org (Postfix) with ESMTPSA id 758E1342342;
	Thu, 11 May 2017 00:33:24 +0000 (UTC)
Date: Wed, 10 May 2017 21:34:56 -0300
From: Matias Fonzo <selk@dragora.org>
To: =?UTF-8?B?UMOhZHJhaWc=?= Brady <P@draigBrady.com>
Cc: Coreutils <coreutils@gnu.org>
Subject: Re: doubt about sync(1) for shutdown the system
Message-ID: <20170510213456.0f281c8c@rafaela>
In-Reply-To: <3d910491-5656-91c8-7794-58be3134342f@draigBrady.com>
References: <20170510194908.54c53b73@rafaela>
	<3d910491-5656-91c8-7794-58be3134342f@draigBrady.com>
Organization: Dragora GNU/Linux-Libre
X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.10; x86_64-dragora-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
	boundary="Sig_/j=rx7C0igUNVKsDnRBzzywq";
	protocol="application/pgp-signature"
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 69.61.93.52
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 11 May 2017 00:35:34 -0000

--Sig_/j=rx7C0igUNVKsDnRBzzywq
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Wed, 10 May 2017 17:17:16 -0700
P=C3=A1draig Brady <P@draigBrady.com> wrote:

> On 10/05/17 15:49, Matias Fonzo wrote:
> > Hi there,
> >=20
> > I am writing a shutdown script for the boot process.
> >=20
> > I have a little question, which is exactly the order to apply
> > correctly sync(1)?:
> >=20
> >   1. Before to unmount swap devices, local/remote filesystems?.
> >=20
> >   2. Between the unmount of swap device(s) and local/remote
> >   file systems?.
> >=20
> >   3. After to unmount everything?.
> >=20
> >   4. ... ?.
> >=20
> > Thanks,
> > Matias
> >  =20
>=20
> Note sync(1) doesn't return any errors from sync(2)
> as the later always "succeeds".
> Also syncing is implicit in umount.
> Hence on modern systems calling sync(1) is IMHO redundant
> if doing a umount anyway.
> Consider also data written after the sync and before the umount.
> Therefore the kernel umount is the only place that can
> do that appropriate syncing without races.

Good.  I was thinking in do that -- before and after, I do not consider
the after as "explicit", because the halt implementation that I have,
does the sync, too.

Thanks again,
Mat=C3=ADas


--Sig_/j=rx7C0igUNVKsDnRBzzywq
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQJ8BAEBCgBmBQJZE7GwXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQzNUJEQjlENDZCNTZCNUZBQ0I2NDdDOUIz
QUFGMUNFQzIwM0E5OUQ1AAoJEDqvHOwgOpnVhaIP/0RZPh2KTulifcSmqIDiiKma
kgHPpbmmHO3oHk0FMN+4MMX5DWdZBrxBnpGdRHgyDO8bAi72wO+lmwM3YnVWbUsZ
9VbREquio/jFgoK+//SIKsRUulb9U5AbXn9DhVgzN0aCCEyfQ4Ue5a1vr271TWWo
4mUa5Q41Ezw4dZswO5aOF1u4mbshS2pLMa33/cQWmUmKzbZ8fYSwAx3CIUyNLSFX
/fhJFE1+uxnEwt2BIGYej8QR9bGMp/l8xW/R2qrog/Ctxhaji6zhxxJa22hysVc1
GFqT7NGIZBFsh3d4nhKAe58fwmCAq9x4NGPFvJIzX0ju+l0xWLSCBUMnywKSGfys
1bWPMGNffSwztB/h1FcP0wUDJcPj/yNa7KamkNAj9UwikJ/d8Hr5LOsP83U+p1jQ
1hDI/C6gTQ5Puaiwg6TxvU0+2e007J5LgzSPqhxqu962lWFHbL/3jxaeDJMoX4ti
YbSl2KOQC+R4BJkpo89vI24PLi2K6osbKNXhhzx3xPZYxAb4AQqXgVCVHUCmxDPU
P8TokX80xo8//Eh1FukX5Ez5TScpmiYPOZv4Z4ECavLj9/YgIwOmwkLBlX0Cf2mw
E0BJkj/8J117KqXk9zfePByh1ykUs3UlOfj5d1Ngm/0QL0mPgQCZkLsMJnezt7Wq
6qJ06HPxbrg/MSnx1T3w
=bFeX
-----END PGP SIGNATURE-----

--Sig_/j=rx7C0igUNVKsDnRBzzywq--


From MAILER-DAEMON Mon May 22 10:10:25 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dCo2S-0008JH-Vh
	for mharc-coreutils@gnu.org; Mon, 22 May 2017 10:10:24 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:60517)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <grikukan@mail.ru>) id 1dCnsx-00011h-Tj
	for coreutils@gnu.org; Mon, 22 May 2017 10:00:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <grikukan@mail.ru>) id 1dCnst-0006Y5-Rh
	for coreutils@gnu.org; Mon, 22 May 2017 10:00:35 -0400
Received: from f149.i.mail.ru ([128.140.171.242]:50154)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <grikukan@mail.ru>) id 1dCnst-0006XD-Go
	for coreutils@gnu.org; Mon, 22 May 2017 10:00:31 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru;
	s=mail2; 
	h=Content-Type:Message-ID:Reply-To:Date:MIME-Version:Subject:To:From;
	bh=a5O7dbRP6uDJBJX+eddyRCEp4liE5sv80x8xmvwRQLg=; 
	b=pJrV4q+51ihcEbjqkQxRXrkDMzP8osjc7b83TQ65T+Irzbk+S3/Ro+LjS47MbUH+CACbTHX/4AHVTngybrAO1Xv1UYM0jxJyZwQb85yMwqNki9vZYRsS9X8YneGtLsKijPPpzM/gMELzwbQvt1GXsw+38W3K5sciRSOMNxc+kB8=;
Received: by f149.i.mail.ru with local (envelope-from <grikukan@mail.ru>)
	id 1dCnso-0004Jk-EM
	for coreutils@gnu.org; Mon, 22 May 2017 17:00:26 +0300
Received: by e.mail.ru with HTTP;
	Mon, 22 May 2017 17:00:26 +0300
From: =?UTF-8?B?0JPRgNC40LPQvtGA0LjQuSDQoNC10LfQvdC40LrQvtCy?=
	<grikukan@mail.ru>
To: coreutils@gnu.org
Subject: =?UTF-8?B?Q29udHJpYnV0aW9u?=
MIME-Version: 1.0
X-Mailer: Mail.Ru Mailer 1.0
Date: Mon, 22 May 2017 17:00:26 +0300
Reply-To: =?UTF-8?B?0JPRgNC40LPQvtGA0LjQuSDQoNC10LfQvdC40LrQvtCy?=
	<grikukan@mail.ru>
X-Priority: 3 (Normal)
Message-ID: <1495461626.932912636@f149.i.mail.ru>
Authentication-Results: f149.i.mail.ru; auth=pass smtp.auth=grikukan@mail.ru
	smtp.mailfrom=grikukan@mail.ru
X-7FA49CB5: 0D63561A33F958A5AA6FA9556DD7327CB9FA3400E475BB0DD8F45A0239275811725E5C173C3A84C369456C5265B6C55C88EE6594D04C4D955E97997F8902A7B9C4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0F5D41B9178041F3E72623479134186CDE6BA297DBC24807EABDAD6C7F3747799A
X-Mailru-Sender: 44AD72AF13E00BA4E22437EBB93BEE360A88A8FD2760DDFD551615E170F753B93ED54139B0A87D3C80683B1EBFD6753F415615537513E8C32AA86DE0DC95E5E51663626B50B4618A000C344B716123E4DF843308AACAA5BBB4A721A3011E896F
X-Mras: OK
X-Spam: undefined
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 128.140.171.242
X-Mailman-Approved-At: Mon, 22 May 2017 10:10:24 -0400
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: base64
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 22 May 2017 14:00:36 -0000

SGVsbG8sCgpXaGVyZSBpcyBpdCBwb3NzaWJsZSB0byBmaW5kIHNvbWUgdG9kbyBsaXN0IGZvciBj
b3JldXRpbHM/IEkgd2FudCB0byB0cnkgdG8gY29udHJpYnV0ZSB0byBjb3JldXRpbHMgZHVyaW5n
IHN1bW1lciB2YWNhdGlvbiB0byBnZXQgc29tZSBleHBlcmllbmNlIGFuZCBoZWxwIHByb2plY3Qs
IGJ1dCBJIGRvbid0IGtub3cgd2hlcmUgdG8gc3RhcnQgYW5kIHdoYXQgdG8gZG8uCgpCZXN0IHJl
Z2FyZHMsCgpHcmlnb3J5IFJlem5pa292LgoKCg==

From MAILER-DAEMON Mon May 22 16:49:41 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dCuGr-0002mB-Hb
	for mharc-coreutils@gnu.org; Mon, 22 May 2017 16:49:41 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59217)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jbernts@broadpark.no>) id 1dCpar-0004rb-BZ
	for coreutils@gnu.org; Mon, 22 May 2017 11:50:02 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jbernts@broadpark.no>) id 1dCpam-0000jc-H5
	for coreutils@gnu.org; Mon, 22 May 2017 11:50:01 -0400
Received: from erato-smout.broadpark.no ([80.202.10.26]:48998)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jbernts@broadpark.no>) id 1dCpam-0000ib-BJ
	for coreutils@gnu.org; Mon, 22 May 2017 11:49:56 -0400
Received: from osl1cloudm2.nextgentel.net ([80.202.10.59])
	by erato-smout.broadpark.no
	(Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit
	(built Aug
	30 2012)) with ESMTP id <0OQC00JRMZGTYO00@erato-smout.broadpark.no> for
	coreutils@gnu.org; Mon, 22 May 2017 16:49:53 +0200 (CEST)
Received: from jostein ([89.10.139.184])
	by cmsmtp with SMTP	id Coefdsq9jyXyJCoefdSQox;
	Mon, 22 May 2017 16:49:53 +0200
Received: by jostein (Postfix, from userid 1000)	id 576BB18084F; Mon,
	22 May 2017 16:50:01 +0200 (CEST)
Date: Mon, 22 May 2017 16:50:01 +0200
From: Jostein Berntsen <jbernts@broadpark.no>
Subject: Re: Contribution
In-reply-to: <1495461626.932912636@f149.i.mail.ru>
To: coreutils@gnu.org
Message-id: <20170522145001.GA2798@jostein>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8; format=flowed
Content-transfer-encoding: QUOTED-PRINTABLE
Content-disposition: inline
X-Original-Source-IP: 89.10.139.184
X-Editor: Vim 8.0 http://www.vim.org/
X-CMAE-Envelope: MS4wfFlhxgmhClyF/a/uPnqUm5kWkr1Pu7FwjJnBTpwA/ENBi2eVZlvfZ49NYMN0bVKayz9Op81RSeie+lwWBKrLCM0gNRrGKRq57dCgPVHLI27LZXX5OatvvTmGJmngPD5iqo76otHpd0nhPAAD3gg1mjzbPUGM1xRF4EjovKRTB7Ph
References: <1495461626.932912636@f149.i.mail.ru>
User-Agent: Mutt/1.7.2 (2016-11-26)
X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic]
	[fuzzy]
X-Received-From: 80.202.10.26
X-Mailman-Approved-At: Mon, 22 May 2017 16:49:40 -0400
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 22 May 2017 15:50:02 -0000

On 22.05.17,17:00, =D0=93=D1=80=D0=B8=D0=B3=D0=BE=D1=80=D0=B8=D0=B9 =
=D0=A0=D0=B5=D0=B7=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2 wrote:
>Hello,
>
>Where is it possible to find some todo list for coreutils? I want to=
 try to contribute to coreutils during summer vacation to get some ex=
perience and help project, but I don't know where to start and what t=
o do.
>
>Best regards,
>
>Grigory Reznikov.

You will find the latest TODO file here:

http://git.savannah.gnu.org/cgit/coreutils.git/tree/TODO

There is also more on contribution at the end of this page:

http://www.pixelbeat.org/docs/coreutils-testing.html


Jostein



From MAILER-DAEMON Thu May 25 10:09:50 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dDtSX-0004WF-V5
	for mharc-coreutils@gnu.org; Thu, 25 May 2017 10:09:50 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59665)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <962-396-1872@kylheku.com>) id 1dDhIF-0001DL-3h
	for coreutils@gnu.org; Wed, 24 May 2017 21:10:24 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <962-396-1872@kylheku.com>) id 1dDhIA-0005s4-32
	for coreutils@gnu.org; Wed, 24 May 2017 21:10:23 -0400
Received: from smtp-out-no.shaw.ca ([64.59.134.12]:57265)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <962-396-1872@kylheku.com>)
	id 1dDhI9-0005pP-Qt
	for coreutils@gnu.org; Wed, 24 May 2017 21:10:18 -0400
Received: from kylheku.com ([70.79.163.252]) by shaw.ca with SMTP
	id DhI1dySY8ETFpDhI3dt4JG; Wed, 24 May 2017 19:10:11 -0600
X-Authority-Analysis: v=2.2 cv=dZbw5Tfe c=1 sm=1 tr=0
	a=95A0EdhkF1LMGt25d7h1IQ==:117 a=95A0EdhkF1LMGt25d7h1IQ==:17
	a=IkcTkHD0fZMA:10 a=SMorJkV_YP8A:10 a=tJ8p9aeEuA8A:10
	a=ZLIFk5GLduUpqU0F700A:9 a=6OVWdWxklIJtQvp2:21 a=hl5Brs-GzTZeU4_A:21
	a=QEXdDO2ut3YA:10
Received: from www-data by kylheku.com with local (Exim 4.72)
	(envelope-from <962-396-1872@kylheku.com>) id 1dDhI0-0003dD-Gb
	for coreutils@gnu.org; Wed, 24 May 2017 18:10:08 -0700
To: coreutils@gnu.org
Subject: [PATCH] env: support encoding of args into command.
X-PHP-Originating-Script: 501:rcmail.php
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8;
 format=flowed
Content-Transfer-Encoding: quoted-printable
Date: Wed, 24 May 2017 18:10:08 -0700
From: "Kaz Kylheku (Coreutils)" <962-396-1872@kylheku.com>
Message-ID: <abc38ce047aa0b6601983350b6965709@mail.kylheku.com>
X-Sender: 962-396-1872@kylheku.com
User-Agent: Roundcube Webmail/0.9.2
X-CMAE-Envelope: MS4wfCX96wJzIDZ+MqcI70wbHne7FNMRo+oswLYLtY3PJ+8GJ74KlYsAO78MDbTBbWG0Ddm0QnV8AixpKuczWGwbyjlpaX8wDDYZ1ybh6A4UtKK5jrO1K1wF
	IjiRGE72Jan0EVbskiljhPtaQQ1Kdf6QnztAy6ZIeAhsYUgo0Kug5V9O
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 64.59.134.12
X-Mailman-Approved-At: Thu, 25 May 2017 10:09:48 -0400
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 25 May 2017 01:10:24 -0000

This is a new feature which allows the command argument of env to encode
multiple extra arguments, as well as the relocation of the first
trailing argument among those arguments.

* src/env.c (usage): Mention the existence of the feature.
(expand_command_notation): New function.
(main): Detect whether the notation is present, based on the first
character of command. If so, filter the trailing part of the argument
vector through the expand_command_notation function, and use that.
Either way, the effective vector is referenced using the down_argv
variable and that is used for the execvp call.
If an error occurs, the diagnostic refers to the first element of
down_argv rather than the original argv.

* tests/misc/env.sh: Added some test cases. Doesn't probe all the corner
cases. I solemnly declare that I manually tested those corner cases,
like "env :" and "env :{}" and such, and used valgrind for
all the manual testing to be confident that there are no
overruns or uses of uninitialized bytes.

* doc/coreutils.texi: Documented feature. Added discussion about how
env is often used for the hash bang mechanism, and how the feature
relates to this use.
---
  doc/coreutils.texi | 63=20
+++++++++++++++++++++++++++++++++++++++++++++++++++++
  src/env.c          | 64=20
++++++++++++++++++++++++++++++++++++++++++++++++++++--
  tests/misc/env.sh  | 18 +++++++++++++++
  3 files changed, 143 insertions(+), 2 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 1834e92..9e1cb0c 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -16879,6 +16879,69 @@ env -u EDITOR PATH=3D/energy -- e=3Dmc2 bar baz

  @end itemize

+Note that the ability to run commands in a modified environment is=20
built into
+the shell language, using a very similar=20
@samp{@var{variable}=3D@var{value}}
+syntax; moreover, that syntax allows commands internal to the shell to=20
be run
+in a modified environment, which is not possible with the external
+@command{env}.  Other scripting languages usually also have their own=20
built-in
+mechanisms for manipulating the environment around the execution of a=20
child
+program.  Therefore the external @command{env} executable is rarely=20
needed for
+the purpose of running a command in a modified environment.  Because=20
the
+@command{env} utility uses @env{PATH} to search for @var{command}, it=20
has come
+to be mainly used as a mechanism in "hash bang" scripting. In this=20
usage,
+scripts are written using the incantation @samp{#!/usr/bin/env interp}=20
where
+@var{interp} is the name of some scripting language interpreter. The
+@command{env} utility provides value by searching @env{PATH} for the=20
location
+of the interpreter executable. This allows the interpreter to be=20
installed in
+some chosen location, without that location having to be edited into=20
the hash
+bang scripts which refer to that interpreter.
+
+On some operating systems, the following issue exists: the hash bang
+interpreter mechanism allows only one argument. Therefore, if the=20
@command{env}
+incantation @samp{#!/usr/bin/env interp} is used, it is not possible to=20
pass an
+argument to @samp{interp}, which is a crippling limitation in some
+circumstances requiring clumsy workarounds. To overcome this=20
difficulty, the
+GNU Coreutils version of @command{env} supports a special notation:
+arguments for @var{command} can be embedded in the @var{command}=20
argument
+itself as follows.  If @var{command} begins with the @samp{:} (colon)
+character, then that colon character is removed. The remainder of the
+argument is treated as record of colon-separated fields, and split
+accordingly. For instance if @var{command} is @samp{:foo:--bar:42},=20
then
+it is split into the fields @samp{foo}, @samp{--bar} and @samp{42}. The
+effective command is then just @samp{foo}. The other two fields will be
+passed as the first two arguments to @samp{foo}, inserted before the
+remaining @var{args}, if @samp{foo} is successfully found using
+@env{PATH} and executed.
+Furthermore, this special supports one more refinement.
+If, after colon splitting, one or more of the fields are
+equal to the character string @samp{@{@}} (open brace, closed brace)
+then the leftmost such field is replaced with the first of the=20
@var{args}
+which follow @var{command}. In this case, that argument is removed from
+@var{args}. If @var{args} is empty, then the field is not replaced.
+
+Example: @command{env} hash bang line for a script executed by the
+fictitious @samp{intercal} interpreter. The @samp{--strict-iso} option
+is passed to the interpreter, and the @samp{--verbose} option is
+passed to the script:
+
+@example
+#!/usr/bin/env :intercal:--strict-iso:@{@}:--verbose
+... script goes here ...
+@end example
+
+When the above hash bang script is invoked with the arguments=20
@samp{alpha} and
+@samp{omega}, @command{env} is invoked with four arguments arguments:=20
the
+argument @samp{:intercal:--strict-iso:@{@}:--verbose}, followed by the
+path name to the above script itself, followed by @samp{alpha} and=20
@samp{omega}.
+The @command{env} will parse the special notation in the command,=20
producing
+the fields @samp{intercal}, @samp{--strict-iso}, @samp{@{@}} and
+@samp{--verbose}. The @samp{@{@}} field is recognized and replaced with
+the first of the remaining arguments, which is the path to the=20
interpreter.
+This argument is then removed form the remaining arguments. Then
+@command{env} searches @env{PATH} for @samp{intercal}. Upon finding it,
+it executes the interpreter with the arguments @samp{--strict-iso},
+the name of the script, @samp{--verbose}, @samp{alpha} and=20
@samp{omega}.
+

  The program accepts the following options.  Also see @ref{Common=20
options}.
  Options must precede operands.
diff --git a/src/env.c b/src/env.c
index 63d5c2c..20fafdd 100644
--- a/src/env.c
+++ b/src/env.c
@@ -18,6 +18,7 @@

  #include <config.h>
  #include <stdio.h>
+#include <assert.h>
  #include <sys/types.h>
  #include <getopt.h>

@@ -70,11 +71,65 @@ Set each NAME to VALUE in the environment and run=20
COMMAND.\n\
  \n\
  A mere - implies -i.  If no COMMAND, print the resulting=20
environment.\n\
  "), stdout);
+      fputs (_("\
+\n\
+COMMAND supports a notation for encoding a command name plus one or=20
more\n\
+arguments. This is useful when env is used in #! (hash bang)=20
scripting.\n\
+Please see the Info documentation for the details.\n\
+"), stdout);
        emit_ancillary_info (PROGRAM_NAME);
      }
    exit (status);
  }

+char **
+expand_command_notation(char **argv)
+{
+  char *command =3D xstrdup(argv[0] + 1), *p, **pp, **nargv;
+  int nf, argc, a, rest =3D 1;
+
+  for (nf =3D 1, p =3D command; *p; p++)
+    {
+      if (*p =3D=3D ':')
+        nf++;
+    }
+
+  for (argc =3D 0, pp =3D argv; *pp; argc++, pp++)
+    ; /* empty */
+
+  argc +=3D nf - 1;
+
+  if ((nargv =3D malloc((argc + 1) * sizeof *nargv)) =3D=3D NULL || comman=
d=20
=3D=3D NULL)
+    die (EXIT_FAILURE, errno, _("out of memory"));
+
+  for (a =3D 0, p =3D command; ; p++)
+    {
+      char *arg =3D p;
+      char *end =3D p + strcspn(p, ":");
+      char ch =3D *end;
+
+      *end =3D 0;
+
+      if (rest < 2 && strcmp(arg, "{}") =3D=3D 0 && argv[rest])
+        arg =3D argv[rest++];
+
+      nargv[a++] =3D arg;
+
+      if (ch =3D=3D ':')
+        {
+          p =3D end;
+          continue;
+        }
+
+      break;
+    }
+
+  assert (a =3D=3D nf);
+
+  memcpy(&nargv[a], &argv[rest], sizeof nargv[0] * (argc + 2 - rest -=20
a));
+  return nargv;
+}
+
  int
  main (int argc, char **argv)
  {
@@ -154,9 +209,14 @@ main (int argc, char **argv)
        usage (EXIT_CANCELED);
      }

-  execvp (argv[optind], &argv[optind]);
+  char **rest_argv =3D argv + optind;
+  char **down_argv =3D (rest_argv[0][0] =3D=3D ':')
+                     ? expand_command_notation(rest_argv)
+                     : rest_argv;
+
+  execvp (down_argv[0], down_argv);

    int exit_status =3D errno =3D=3D ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INV=
OKE;
-  error (0, errno, "%s", quote (argv[optind]));
+  error (0, errno, "%s", quote (down_argv[0]));
    return exit_status;
  }
diff --git a/tests/misc/env.sh b/tests/misc/env.sh
index f2f6ba8..aeb2b91 100755
--- a/tests/misc/env.sh
+++ b/tests/misc/env.sh
@@ -150,4 +150,22 @@ test "x$(sh -c '\c=3Dd echo fail')" =3D xpass && #dash=
=20
0.5.4 fails so check first
  returns_ 125 env -u a=3Db true || fail=3D1
  returns_ 125 env -u '' true || fail=3D1

+# test the special env :command... notation for encoding arguments
+test "$(env :echo)" =3D "" || fail=3D1
+test "$(env :echo:)" =3D "" || fail=3D1
+test "$(env :echo:a)" =3D "a" || fail=3D1
+test "$(env :echo:a:b)" =3D "a b" || fail=3D1
+test "$(env :echo:a b)" =3D "a b" || fail=3D1
+test "$(env :echo:a: b)" =3D "a  b" || fail=3D1
+test "$(env :echo:a:b c d)" =3D "a b c d" || fail=3D1
+test "$(env :echo:aa:bb cc dd)" =3D "aa bb cc dd" || fail=3D1
+test "$(env :echo:{}:bb cc dd)" =3D "cc bb dd" || fail=3D1
+test "$(env :echo:{} cc dd)" =3D "cc dd" || fail=3D1
+test "$(env :echo:{}:aa:bb cc dd)" =3D "cc aa bb dd" || fail=3D1
+test "$(env :echo:{})" =3D "{}" || fail=3D1
+test "$(env :echo:{}:{})" =3D "{} {}" || fail=3D1
+test "$(env :echo:{}:a)" =3D "{} a" || fail=3D1
+test "$(env :echo:{}:a b)" =3D "b a" || fail=3D1
+test "$(env :echo:{}:{} b)" =3D "b {}" || fail=3D1
+
  Exit $fail
--=20
2.9.3



From MAILER-DAEMON Thu May 25 10:09:50 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dDtSY-0004WU-3y
	for mharc-coreutils@gnu.org; Thu, 25 May 2017 10:09:50 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:37713)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aixtools@gmail.com>) id 1dDi2q-0007C1-Lp
	for coreutils@gnu.org; Wed, 24 May 2017 21:58:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <aixtools@gmail.com>) id 1dDi2o-0005yP-Vl
	for coreutils@gnu.org; Wed, 24 May 2017 21:58:32 -0400
Received: from mail-oi0-x22f.google.com ([2607:f8b0:4003:c06::22f]:35888)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <aixtools@gmail.com>) id 1dDi2o-0005xq-ON
	for coreutils@gnu.org; Wed, 24 May 2017 21:58:30 -0400
Received: by mail-oi0-x22f.google.com with SMTP id h4so264210052oib.3
	for <coreutils@gnu.org>; Wed, 24 May 2017 18:58:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:content-transfer-encoding;
	bh=CGc6tDk43wqpuimwl928H18CCi+h9fYwIwgi8Oat5QI=;
	b=DyO4J8Y0AnI3MFiEfbNQjXIGljm/UuMToKG+Oi2NNRfydve53MXYEAvpwqTnILrGxI
	pD/ucw0SZ2GUf6+NNipvZjziihVTSUvQD0ip02x3hdrADCmALtmFJMU6bq/4mTDdBp8u
	vuKit6Jg2LMS3GkkB+l+2jDxFvjflsqoCoOtDfyM9WudYy3+MRXryQIhXYiEJ3gjgeWa
	KF/OIXkZ6FUAqiW7VsiY6RbWWcnM8ktp88rOcsHm19o3X/ZM1l9U0T26z9LK9xhs85ej
	lnmeCeP4B+zqLmUdIVIVcFlzIt5T45xbwh54jGGe0FGNeEB6UbIeQ44CAqXV2jI0hiR/
	xWFw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:content-transfer-encoding;
	bh=CGc6tDk43wqpuimwl928H18CCi+h9fYwIwgi8Oat5QI=;
	b=saiWeiXiMSltyn2C9ekRX8BIU/PE4E+bGIVKE97ICh/fCqnkw5UJPDsogKr2NYW2V9
	kCZUXwLPA9Q6f4F1KhW7ssWf/jrmqQb3BG0i7ZJLOc5J4pCJ5fp5I/HO/tPuGvSJP9oz
	rxQFz0AFu0x5qhUY9ndfgkaV9j9KOAJbTJ/H79bS+lo/m/HyzdT8FKCuKwuziNiT6O6w
	78F0fcJZ5P/1UzkaPyUVnYXUJFNJkf0gRk/HJPY5KuTEhzMzxo2hAdsVvQvqzHnJjHWg
	k/qf7cEiUyAyhbiREdBHO0VVEvN0mdSJzlBjlNOuYQWHMOgM01geveYF7AkUTlnpb9by
	sKnw==
X-Gm-Message-State: AODbwcCMNhVOEBVmb6F2rdUj28kohaQyCHMh3sBAnJKan3tWZFEgs1vY
	cFYS73XHlFRAOzqbfvjkN6rT0tjOozps
X-Received: by 10.157.8.107 with SMTP id 98mr7082431oty.20.1495677509264; Wed,
	24 May 2017 18:58:29 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.182.219.165 with HTTP; Wed, 24 May 2017 18:58:28 -0700 (PDT)
In-Reply-To: <8e8eaed6-2358-e2fe-272d-689101d2b30f@draigBrady.com>
References: <8e8eaed6-2358-e2fe-272d-689101d2b30f@draigBrady.com>
From: Michael Felt <aixtools@gmail.com>
Date: Thu, 25 May 2017 04:58:28 +0300
Message-ID: <CANvxniXzbZoQBDUpmhuT7zsK9d18DnZKCCYRiNDtQabv-E6tWQ@mail.gmail.com>
Subject: Re: coreutils-8.27 released [stable]
To: Coreutils <coreutils@gnu.org>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2607:f8b0:4003:c06::22f
X-Mailman-Approved-At: Thu, 25 May 2017 10:09:48 -0400
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 25 May 2017 01:58:34 -0000

Hi, Probably I never packaged 8.26, so maybe this has been around since the=
n.

I cannot build 8.27, I am getting errors.

a) "-include config.h" is being passed to xlc_r and that does not work.
b) there seems to be an issue with the correct order of loading
include files - AIX is perhaps not the same order as GNU.

        source=3D'src/md5sum.c' object=3D'src/src_b2sum-md5sum.o'
libtool=3Dno  DEPDIR=3D.deps depmode=3Dxlc /bin/sh
../src/coreutils-8.27/build-aux/depcomp  xlc_r  -I.
-I../src/coreutils-8.27 -I./lib  -include config.h
-DHASH_ALGO_BLAKE2=3D1  -Ilib -I../src/coreutils-8.27/lib -Isrc
-I../src/coreutils-8.27/src -I/opt/include -I/opt/buildaix/include
-D_THREAD_SAFE  -I/opt/include -O2 -qmaxmem=3D-1 -qarch=3Dpwr5
-I/opt/buildaix/includes -c -o src/src_b2sum-md5sum.o `test -f
'src/md5sum.c' || echo '../src/coreutils-8.27/'`src/md5sum.c
xlc_r: 1501-218 (W) file config.h contains an incorrect file suffix
xlc_r: 1501-228 (W) input file config.h not found
make: 1254-004 The error code from the last command is 252.


Stop.
make: 1254-004 The error code from the last command is 1.


Stop.
make: 1254-004 The error code from the last command is 2.


xlc_r  -I. -I../src/coreutils-8.27 -I./lib  -DHASH_ALGO_BLAKE2=3D1
-Ilib -I../src/coreutils-8.27/lib -Isrc -I../src/coreutils-8.27/src
-I/opt/include -I/opt/buildaix/include -D_THREAD_SAFE  -I/opt/include
-O2 -qmaxmem=3D-1 -qarch=3Dpwr5 -I/opt/buildaix/includes -c -o
src/src_b2sum-md5sum.o `test -f 'src/md5sum.c' || echo
'../src/coreutils-8.27/'`src/md5sum.c

xlc_r  -I. -I../src/coreutils-8.27 -I./lib  -include config.h
-DHASH_ALGO_BLAKE2=3D1  -Ilib -I../src/coreutils-8.27/lib -Isrc
-I../src/coreutils-8.27/src -I/opt/include -I/opt/buildaix/include
-D_THREAD_SAFE  -I/opt/include -O2 -qmaxmem=3D-1 -qarch=3Dpwr5
-I/opt/buildaix/includes -c -o src/blake2/src_b2sum-blake2b-ref.o
`test -f 'src/blake2/blake2b-ref.c' || echo
'../src/coreutils-8.27/'`src/blake2/blake2b-ref.c
xlc_r  -I. -I../src/coreutils-8.27 -I./lib  -DHASH_ALGO_BLAKE2=3D1
-Ilib -I../src/coreutils-8.27/lib -Isrc -I../src/coreutils-8.27/src
-I/opt/include -I/opt/buildaix/include -D_THREAD_SAFE  -I/opt/include
-O2 -qmaxmem=3D-1 -qarch=3Dpwr5 -I/opt/buildaix/includes -c -o
src/blake2/src_b2sum-blake2b-ref.o `test -f 'src/blake2/blake2b-ref.c'
|| echo '../src/coreutils-8.27/'`src/blake2/blake2b-ref.c

xlc_r  -I. -I../src/coreutils-8.27 -I./lib  -include config.h
-DHASH_ALGO_BLAKE2=3D1  -Ilib -I../src/coreutils-8.27/lib -Isrc
-I../src/coreutils-8.27/src -I/opt/include -I/opt/buildaix/include
-D_THREAD_SAFE  -I/opt/include -O2 -qmaxmem=3D-1 -qarch=3Dpwr5
-I/opt/buildaix/includes -c -o src/blake2/src_b2sum-b2sum.o `test -f
'src/blake2/b2sum.c' || echo
'../src/coreutils-8.27/'`src/blake2/b2sum.c
xlc_r  -I. -I../src/coreutils-8.27 -I./lib  -DHASH_ALGO_BLAKE2=3D1
-Ilib -I../src/coreutils-8.27/lib -Isrc -I../src/coreutils-8.27/src
-I/opt/include -I/opt/buildaix/include -D_THREAD_SAFE  -I/opt/include
-O2 -qmaxmem=3D-1 -qarch=3Dpwr5 -I/opt/buildaix/includes -c -o
src/blake2/src_b2sum-b2sum.o `test -f 'src/blake2/b2sum.c' || echo
'../src/coreutils-8.27/'`src/blake2/b2sum.c

"./lib/unistd.h", line 139.3: 1506-205 (S) #error "Please include
config.h first."
"./lib/unistd.h", line 141.1: 1506-485 (S) Parameter declaration list
is incompatible with declarator for _GL_INLINE_HEADER_BEGIN.
"./lib/unistd.h", line 1943.1: 1506-276 (S) Syntax error: possible missing =
'{'?


p.s. I need to change my email address for coreutils - it may take a
bit before I see a reply (working on it!).

Michael

p.p.s. - why have your own "unistd.h", I consider that a "system" file, e.g=
.,

root@x064:[/data/prj/gnu/coreutils-8.27]lslpp -w | grep unistd.h
  /usr/vacpp/include/unistd.h                 vacpp.cmp.include     File
  /usr/include/unistd.h                       bos.adt.include       File

On Thu, Mar 9, 2017 at 8:16 AM, P=C3=A1draig Brady <P@draigbrady.com> wrote=
:
> This is to announce coreutils-8.27, a stable release.
> See the NEWS below for more details.
>
> Thanks to everyone who has contributed!
> The following people contributed changes to this release:
>
> There have been 67 commits by 16 people in the 14 weeks since 8.26
>
>   Assaf Gordon (5)        Nicolas Iooss (1)
>   Bernhard Voelker (4)    Niels M=C3=B6ller (1)
>   Eric Blake (1)          Paul Eggert (14)
>   Janne Snabb (1)         P=C3=A1draig Brady (35)
>   Jim Meyering (1)        Tobias Stoeckmann (1)
>   Manolis Ragkousis (1)   Torbj=C3=B6rn Granlund (1)
>   Maxime de Roucy (1)     William R. Fraser (1)
>   Mike Swanson (1)        Zooko (1)
>
> P=C3=A1draig [on behalf of the coreutils maintainers]
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> Here is the GNU coreutils home page:
>     http://gnu.org/software/coreutils/
>
> For a summary of changes and contributors, see:
>   http://git.sv.gnu.org/gitweb/?p=3Dcoreutils.git;a=3Dshortlog;h=3Dv8.27
> or run this command from a git-cloned coreutils directory:
>   git shortlog v8.26..v8.27
>
> To summarize the 198 gnulib-related changes, run these commands
> from a git-cloned coreutils directory:
>   git checkout v8.27
>   git submodule summary v8.26
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> Here are the compressed sources and a GPG detached signature[*]:
>   http://ftp.gnu.org/gnu/coreutils/coreutils-8.27.tar.xz
>   http://ftp.gnu.org/gnu/coreutils/coreutils-8.27.tar.xz.sig
>
> Use a mirror for higher download bandwidth:
>   http://ftpmirror.gnu.org/coreutils/coreutils-8.27.tar.xz
>   http://ftpmirror.gnu.org/coreutils/coreutils-8.27.tar.xz.sig
>
> [*] Use a .sig file to verify that the corresponding file (without the
> .sig suffix) is intact.  First, be sure to download both the .sig file
> and the corresponding tarball.  Then, run a command like this:
>
>   gpg --verify coreutils-8.27.tar.xz.sig
>
> If that command fails because you don't have the required public key,
> then run this command to import it:
>
>   gpg --keyserver keys.gnupg.net --recv-keys DF6FD971306037D9
>
> and rerun the 'gpg --verify' command.
>
> This release was bootstrapped with the following tools:
>   Autoconf 2.69
>   Automake 1.15
>   Gnulib v0.1-1185-g405cd67
>   Bison 3.0.4
>
> NEWS
>
> * Noteworthy changes in release 8.27 (2017-03-08) [stable]
>
> ** Bug fixes
>
>   cp --parents will now set an SELinux context for created directories,
>   as appropriate for the -a, --preseve=3Dcontext, or -Z options.
>   [bug present since SELinux support added in coreutils-6.10]
>
>   date again converts from a specified time zone.  Previously output was
>   not converted to the local time zone, and remained in the specified one=
.
>   [bug introduced in coreutils-8.26]
>
>   Commands like 'cp --no-dereference -l A B' are no longer quiet no-ops
>   when A is a regular file and B is a symbolic link that points to A.
>   [bug introduced in fileutils-4.0]
>
>   factor no longer goes into an infinite loop for certain numbers like
>   158909489063877810457 and 222087527029934481871.
>   [bug introduced in coreutils-8.20]
>
>   tail no longer prints redundant file headers with interleaved inotify e=
vents,
>   which could be triggered especially when tail was suspended and resumed=
.
>   [bug introduced with inotify support added in coreutils-7.5]
>
>   timeout no longer has a race that may terminate the wrong process.
>   The race is unlikely, as timeout(1) needs to receive a signal right
>   after the command being monitored finishes.  Also the system needs
>   to have reallocated that command's pid in that short time window.
>   [bug introduced when timeout was added in coreutils-7.0]
>
>   wc --bytes --files0-from now correctly reports byte counts.
>   Previously it may have returned values that were too large,
>   depending on the size of the first file processed.
>   [bug introduced in coreutils-8.24]
>
> ** Improvements
>
>   The new 'date' option --rfc-email is now the long form for -R.
>   The new option spelling is intended to avoid the need to track the
>   Internet RFC number for email dates (currently RFC 5322).  The old
>   option spellings --rfc-2822 and --rfc-822 still work.
>
>   date now outputs "-00" for a numeric time zone if the time is UTC
>   and the time zone abbreviation begins with "-", indicating that the
>   time zone is indeterminate.
>
>   nproc now honors the OMP_THREAD_LIMIT environment variable to
>   set the maximum returned value.  OMP_NUM_THREADS continues to
>   set the minimum returned value, but is updated to support the
>   nested level syntax allowed in this variable.
>
>   stat and tail now know about the "rdt" file system, which is an interfa=
ce
>   to Resource Director Technology.  stat -f --format=3D%T now reports the
>   file system type, and tail -f uses inotify.
>
>   stty now validates arguments before interacting with the device,
>   ensuring there are no side effects to specifying an invalid option.
>
>   If the file B already exists, commands like 'ln -f A B' and
>   'cp -fl A B' no longer remove B before creating the new link.
>   That is, there is no longer a brief moment when B does not exist.
>
> ** New features
>
>   expand and unexpand now support specifying a tab size to use
>   after explicitly specified tab stops, by prefixing the last
>   specified number like --tabs=3D2,4,/8.
>
> -
> Also posted at https://savannah.gnu.org/forum/forum.php?forum_id=3D8810
>
>
> --
> If you have a working or partly working program that you'd like
> to offer to the GNU project as a GNU package,
> see https://www.gnu.org/help/evaluation.html.


From MAILER-DAEMON Thu May 25 10:09:50 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dDtSY-0004Wt-Gg
	for mharc-coreutils@gnu.org; Thu, 25 May 2017 10:09:50 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:58953)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <kaz@kylheku.com>) id 1dDhEI-00006m-3O
	for coreutils@gnu.org; Wed, 24 May 2017 21:06:19 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <kaz@kylheku.com>) id 1dDhED-0004cv-12
	for coreutils@gnu.org; Wed, 24 May 2017 21:06:17 -0400
Received: from smtp-out-no.shaw.ca ([64.59.134.13]:46608)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <kaz@kylheku.com>) id 1dDhEC-0004Zg-OL
	for coreutils@gnu.org; Wed, 24 May 2017 21:06:12 -0400
Received: from kylheku.com ([70.79.163.252]) by shaw.ca with SMTP
	id DhDvdyRK0ETFpDhDwdt3U7; Wed, 24 May 2017 19:05:59 -0600
X-Authority-Analysis: v=2.2 cv=dZbw5Tfe c=1 sm=1 tr=0
	a=95A0EdhkF1LMGt25d7h1IQ==:117 a=95A0EdhkF1LMGt25d7h1IQ==:17
	a=IkcTkHD0fZMA:10 a=SMorJkV_YP8A:10 a=tJ8p9aeEuA8A:10
	a=ZLIFk5GLduUpqU0F700A:9 a=6OVWdWxklIJtQvp2:21 a=hl5Brs-GzTZeU4_A:21
	a=QEXdDO2ut3YA:10
Received: from www-data by kylheku.com with local (Exim 4.72)
	(envelope-from <kaz@kylheku.com>) id 1dDhDu-0003WH-AC
	for coreutils@gnu.org; Wed, 24 May 2017 18:05:54 -0700
To: coreutils@gnu.org
Subject: [PATCH] env: support encoding of args into command.
X-PHP-Originating-Script: 501:rcmail.php
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8;
 format=flowed
Content-Transfer-Encoding: quoted-printable
Date: Wed, 24 May 2017 18:05:54 -0700
From: Kaz Kylheku <kaz@kylheku.com>
Message-ID: <1686e7a37ee80b24b183cfef7960ffbf@mail.kylheku.com>
X-Sender: kaz@kylheku.com
User-Agent: Roundcube Webmail/0.9.2
X-CMAE-Envelope: MS4wfMcv9QjKyzFBZETfV2/ukzx2jB3sAEj3H8I4f6E4TKJWsuQQJwa9nxW4QHdnUlCFoNNXSWPoM9a85ll8zkXDknJ4//OWYILG/tThXr7fBiPV23DiMAgb
	um0kQCG83iaQcC2NZMYSoqP8AvFSKHnu1uFrdIH34oPR9c0542r7f6tl
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 64.59.134.13
X-Mailman-Approved-At: Thu, 25 May 2017 10:09:48 -0400
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 25 May 2017 01:06:19 -0000

This is a new feature which allows the command argument of env to encode
multiple extra arguments, as well as the relocation of the first
trailing argument among those arguments.

* src/env.c (usage): Mention the existence of the feature.
(expand_command_notation): New function.
(main): Detect whether the notation is present, based on the first
character of command. If so, filter the trailing part of the argument
vector through the expand_command_notation function, and use that.
Either way, the effective vector is referenced using the down_argv
variable and that is used for the execvp call.
If an error occurs, the diagnostic refers to the first element of
down_argv rather than the original argv.

* tests/misc/env.sh: Added some test cases. Doesn't probe all the corner
cases. I solemnly declare that I manually tested those corner cases,
like "env :" and "env :{}" and such, and used valgrind for
all the manual testing to be confident that there are no
overruns or uses of uninitialized bytes.

* doc/coreutils.texi: Documented feature. Added discussion about how
env is often used for the hash bang mechanism, and how the feature
relates to this use.
---
  doc/coreutils.texi | 63=20
+++++++++++++++++++++++++++++++++++++++++++++++++++++
  src/env.c          | 64=20
++++++++++++++++++++++++++++++++++++++++++++++++++++--
  tests/misc/env.sh  | 18 +++++++++++++++
  3 files changed, 143 insertions(+), 2 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 1834e92..9e1cb0c 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -16879,6 +16879,69 @@ env -u EDITOR PATH=3D/energy -- e=3Dmc2 bar baz

  @end itemize

+Note that the ability to run commands in a modified environment is=20
built into
+the shell language, using a very similar=20
@samp{@var{variable}=3D@var{value}}
+syntax; moreover, that syntax allows commands internal to the shell to=20
be run
+in a modified environment, which is not possible with the external
+@command{env}.  Other scripting languages usually also have their own=20
built-in
+mechanisms for manipulating the environment around the execution of a=20
child
+program.  Therefore the external @command{env} executable is rarely=20
needed for
+the purpose of running a command in a modified environment.  Because=20
the
+@command{env} utility uses @env{PATH} to search for @var{command}, it=20
has come
+to be mainly used as a mechanism in "hash bang" scripting. In this=20
usage,
+scripts are written using the incantation @samp{#!/usr/bin/env interp}=20
where
+@var{interp} is the name of some scripting language interpreter. The
+@command{env} utility provides value by searching @env{PATH} for the=20
location
+of the interpreter executable. This allows the interpreter to be=20
installed in
+some chosen location, without that location having to be edited into=20
the hash
+bang scripts which refer to that interpreter.
+
+On some operating systems, the following issue exists: the hash bang
+interpreter mechanism allows only one argument. Therefore, if the=20
@command{env}
+incantation @samp{#!/usr/bin/env interp} is used, it is not possible to=20
pass an
+argument to @samp{interp}, which is a crippling limitation in some
+circumstances requiring clumsy workarounds. To overcome this=20
difficulty, the
+GNU Coreutils version of @command{env} supports a special notation:
+arguments for @var{command} can be embedded in the @var{command}=20
argument
+itself as follows.  If @var{command} begins with the @samp{:} (colon)
+character, then that colon character is removed. The remainder of the
+argument is treated as record of colon-separated fields, and split
+accordingly. For instance if @var{command} is @samp{:foo:--bar:42},=20
then
+it is split into the fields @samp{foo}, @samp{--bar} and @samp{42}. The
+effective command is then just @samp{foo}. The other two fields will be
+passed as the first two arguments to @samp{foo}, inserted before the
+remaining @var{args}, if @samp{foo} is successfully found using
+@env{PATH} and executed.
+Furthermore, this special supports one more refinement.
+If, after colon splitting, one or more of the fields are
+equal to the character string @samp{@{@}} (open brace, closed brace)
+then the leftmost such field is replaced with the first of the=20
@var{args}
+which follow @var{command}. In this case, that argument is removed from
+@var{args}. If @var{args} is empty, then the field is not replaced.
+
+Example: @command{env} hash bang line for a script executed by the
+fictitious @samp{intercal} interpreter. The @samp{--strict-iso} option
+is passed to the interpreter, and the @samp{--verbose} option is
+passed to the script:
+
+@example
+#!/usr/bin/env :intercal:--strict-iso:@{@}:--verbose
+... script goes here ...
+@end example
+
+When the above hash bang script is invoked with the arguments=20
@samp{alpha} and
+@samp{omega}, @command{env} is invoked with four arguments arguments:=20
the
+argument @samp{:intercal:--strict-iso:@{@}:--verbose}, followed by the
+path name to the above script itself, followed by @samp{alpha} and=20
@samp{omega}.
+The @command{env} will parse the special notation in the command,=20
producing
+the fields @samp{intercal}, @samp{--strict-iso}, @samp{@{@}} and
+@samp{--verbose}. The @samp{@{@}} field is recognized and replaced with
+the first of the remaining arguments, which is the path to the=20
interpreter.
+This argument is then removed form the remaining arguments. Then
+@command{env} searches @env{PATH} for @samp{intercal}. Upon finding it,
+it executes the interpreter with the arguments @samp{--strict-iso},
+the name of the script, @samp{--verbose}, @samp{alpha} and=20
@samp{omega}.
+

  The program accepts the following options.  Also see @ref{Common=20
options}.
  Options must precede operands.
diff --git a/src/env.c b/src/env.c
index 63d5c2c..20fafdd 100644
--- a/src/env.c
+++ b/src/env.c
@@ -18,6 +18,7 @@

  #include <config.h>
  #include <stdio.h>
+#include <assert.h>
  #include <sys/types.h>
  #include <getopt.h>

@@ -70,11 +71,65 @@ Set each NAME to VALUE in the environment and run=20
COMMAND.\n\
  \n\
  A mere - implies -i.  If no COMMAND, print the resulting=20
environment.\n\
  "), stdout);
+      fputs (_("\
+\n\
+COMMAND supports a notation for encoding a command name plus one or=20
more\n\
+arguments. This is useful when env is used in #! (hash bang)=20
scripting.\n\
+Please see the Info documentation for the details.\n\
+"), stdout);
        emit_ancillary_info (PROGRAM_NAME);
      }
    exit (status);
  }

+char **
+expand_command_notation(char **argv)
+{
+  char *command =3D xstrdup(argv[0] + 1), *p, **pp, **nargv;
+  int nf, argc, a, rest =3D 1;
+
+  for (nf =3D 1, p =3D command; *p; p++)
+    {
+      if (*p =3D=3D ':')
+        nf++;
+    }
+
+  for (argc =3D 0, pp =3D argv; *pp; argc++, pp++)
+    ; /* empty */
+
+  argc +=3D nf - 1;
+
+  if ((nargv =3D malloc((argc + 1) * sizeof *nargv)) =3D=3D NULL || comman=
d=20
=3D=3D NULL)
+    die (EXIT_FAILURE, errno, _("out of memory"));
+
+  for (a =3D 0, p =3D command; ; p++)
+    {
+      char *arg =3D p;
+      char *end =3D p + strcspn(p, ":");
+      char ch =3D *end;
+
+      *end =3D 0;
+
+      if (rest < 2 && strcmp(arg, "{}") =3D=3D 0 && argv[rest])
+        arg =3D argv[rest++];
+
+      nargv[a++] =3D arg;
+
+      if (ch =3D=3D ':')
+        {
+          p =3D end;
+          continue;
+        }
+
+      break;
+    }
+
+  assert (a =3D=3D nf);
+
+  memcpy(&nargv[a], &argv[rest], sizeof nargv[0] * (argc + 2 - rest -=20
a));
+  return nargv;
+}
+
  int
  main (int argc, char **argv)
  {
@@ -154,9 +209,14 @@ main (int argc, char **argv)
        usage (EXIT_CANCELED);
      }

-  execvp (argv[optind], &argv[optind]);
+  char **rest_argv =3D argv + optind;
+  char **down_argv =3D (rest_argv[0][0] =3D=3D ':')
+                     ? expand_command_notation(rest_argv)
+                     : rest_argv;
+
+  execvp (down_argv[0], down_argv);

    int exit_status =3D errno =3D=3D ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INV=
OKE;
-  error (0, errno, "%s", quote (argv[optind]));
+  error (0, errno, "%s", quote (down_argv[0]));
    return exit_status;
  }
diff --git a/tests/misc/env.sh b/tests/misc/env.sh
index f2f6ba8..aeb2b91 100755
--- a/tests/misc/env.sh
+++ b/tests/misc/env.sh
@@ -150,4 +150,22 @@ test "x$(sh -c '\c=3Dd echo fail')" =3D xpass && #dash=
=20
0.5.4 fails so check first
  returns_ 125 env -u a=3Db true || fail=3D1
  returns_ 125 env -u '' true || fail=3D1

+# test the special env :command... notation for encoding arguments
+test "$(env :echo)" =3D "" || fail=3D1
+test "$(env :echo:)" =3D "" || fail=3D1
+test "$(env :echo:a)" =3D "a" || fail=3D1
+test "$(env :echo:a:b)" =3D "a b" || fail=3D1
+test "$(env :echo:a b)" =3D "a b" || fail=3D1
+test "$(env :echo:a: b)" =3D "a  b" || fail=3D1
+test "$(env :echo:a:b c d)" =3D "a b c d" || fail=3D1
+test "$(env :echo:aa:bb cc dd)" =3D "aa bb cc dd" || fail=3D1
+test "$(env :echo:{}:bb cc dd)" =3D "cc bb dd" || fail=3D1
+test "$(env :echo:{} cc dd)" =3D "cc dd" || fail=3D1
+test "$(env :echo:{}:aa:bb cc dd)" =3D "cc aa bb dd" || fail=3D1
+test "$(env :echo:{})" =3D "{}" || fail=3D1
+test "$(env :echo:{}:{})" =3D "{} {}" || fail=3D1
+test "$(env :echo:{}:a)" =3D "{} a" || fail=3D1
+test "$(env :echo:{}:a b)" =3D "b a" || fail=3D1
+test "$(env :echo:{}:{} b)" =3D "b {}" || fail=3D1
+
  Exit $fail
--=20
2.9.3



From MAILER-DAEMON Thu May 25 14:13:25 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dDxGH-0007Uj-Nw
	for mharc-coreutils@gnu.org; Thu, 25 May 2017 14:13:25 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:48065)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <962-396-1872@kylheku.com>) id 1dDxGE-0007UF-VU
	for coreutils@gnu.org; Thu, 25 May 2017 14:13:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <962-396-1872@kylheku.com>) id 1dDxGB-0006R3-Mf
	for coreutils@gnu.org; Thu, 25 May 2017 14:13:22 -0400
Received: from smtp-out-no.shaw.ca ([64.59.134.13]:35974)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <962-396-1872@kylheku.com>)
	id 1dDxGB-0006Qr-I2
	for coreutils@gnu.org; Thu, 25 May 2017 14:13:19 -0400
Received: from kylheku.com ([70.79.163.252]) by shaw.ca with SMTP
	id DxG5dkURnM9gtDxG6dInFm; Thu, 25 May 2017 12:13:17 -0600
X-Authority-Analysis: v=2.2 cv=a+JAzQaF c=1 sm=1 tr=0
	a=95A0EdhkF1LMGt25d7h1IQ==:117 a=95A0EdhkF1LMGt25d7h1IQ==:17
	a=IkcTkHD0fZMA:10 a=SMorJkV_YP8A:10 a=tJ8p9aeEuA8A:10
	a=KbFAlDkBa6QGNByHutkA:9 a=QEXdDO2ut3YA:10
Received: from www-data by kylheku.com with local (Exim 4.72)
	(envelope-from <962-396-1872@kylheku.com>) id 1dDxG3-0002Kd-Sd
	for coreutils@gnu.org; Thu, 25 May 2017 11:13:11 -0700
To: coreutils@gnu.org
Subject: Re: [PATCH] env: support encoding of args into command.
X-PHP-Originating-Script: 501:rcmail.php
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8;
 format=flowed
Content-Transfer-Encoding: quoted-printable
Date: Thu, 25 May 2017 11:13:11 -0700
From: "Kaz Kylheku (Coreutils)" <962-396-1872@kylheku.com>
In-Reply-To: <abc38ce047aa0b6601983350b6965709@mail.kylheku.com>
References: <abc38ce047aa0b6601983350b6965709@mail.kylheku.com>
Message-ID: <439b4cad92e2f90845a579697f3816b2@mail.kylheku.com>
X-Sender: 962-396-1872@kylheku.com
User-Agent: Roundcube Webmail/0.9.2
X-CMAE-Envelope: MS4wfNQbviF21Zm//30TFHos/ikvvRNpGLSCM8EszXkVg+LZkksNy6MO09b95xfttegOfUgGSyt49OK2A6eNvLj/Q2i2OioDcUR5+LCWewnchv2LEhtHxVJj
	9s8HDQSEGpOpT+7bobKiuFK2GuTKno+3KWCrf/pgKU5tSBde43r/vR2U
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 64.59.134.13
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 25 May 2017 18:13:24 -0000

On 24.05.2017 18:10, Kaz Kylheku (Coreutils) wrote:
> This is a new feature which allows the command argument of env to=20
> encode
> multiple extra arguments, as well as the relocation of the first
> trailing argument among those arguments.

Looks like my MUA screwed this up with "format=3Dflowed" and
quoted printable.

I will re-send using the "mail" utility.



From MAILER-DAEMON Thu May 25 14:22:27 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dDxP1-0003RN-KS
	for mharc-coreutils@gnu.org; Thu, 25 May 2017 14:22:27 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50241)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <962-396-1872@kylheku.com>) id 1dDxOx-0003R1-Rz
	for coreutils@gnu.org; Thu, 25 May 2017 14:22:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <962-396-1872@kylheku.com>) id 1dDxOs-0001So-Rz
	for coreutils@gnu.org; Thu, 25 May 2017 14:22:23 -0400
Received: from smtp-out-no.shaw.ca ([64.59.134.9]:59288)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <962-396-1872@kylheku.com>)
	id 1dDxOs-0001Se-KG
	for coreutils@gnu.org; Thu, 25 May 2017 14:22:18 -0400
Received: from kylheku.com ([70.79.163.252]) by shaw.ca with SMTP
	id DxOqdkYArM9gtDxOrdIpbI; Thu, 25 May 2017 12:22:17 -0600
X-Authority-Analysis: v=2.2 cv=a+JAzQaF c=1 sm=1 tr=0
	a=95A0EdhkF1LMGt25d7h1IQ==:117 a=95A0EdhkF1LMGt25d7h1IQ==:17
	a=IkcTkHD0fZMA:10 a=tJ8p9aeEuA8A:10 a=fWPnO8r3Nk365HKWIhcA:9
	a=6OVWdWxklIJtQvp2:21 a=hl5Brs-GzTZeU4_A:21 a=QEXdDO2ut3YA:10
Received: from localhost ([127.0.0.1]) by kylheku.com with smtp (Exim 4.72)
	(envelope-from <962-396-1872@kylheku.com>) id 1dDxOf-0002Yf-93
	for coreutils@gnu.org; Thu, 25 May 2017 11:22:14 -0700
From: Kaz Kylheku <962-396-1872@kylheku.com>
Subject: [PATCH] env: support encoding of args into command.
Message-ID: <abc38ce047aa0b6601983350b6993453@mail.kylheku.com>
Content-Type: text/plain; charset=UTF-8
Date: Thu, 25 May 2017 11:15:27 -0700
To: coreutils@gnu.org
User-Agent: telnet to port 25, man!
X-CMAE-Envelope: MS4wfFcoYu1hxw4N71KzV+YD6NatfWmQPwxL9ChKlkg7Pa6B0abOJ66yNVN5unkEpjKZB0yPmQOaYXGCeuyzJpoi43GuGDKv1T+rF+OB7NdnRL9KVyhVqUTT
	S1zNXFBNvPzz290/yUiWkGRHi/TQs6Gtff6B0cKlyUG88KwIljiE4pCZ
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 64.59.134.9
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 25 May 2017 18:22:25 -0000

This is a new feature which allows the command argument of env to encode
multiple extra arguments, as well as the relocation of the first
trailing argument among those arguments.

* src/env.c (usage): Mention the existence of the feature.
(expand_command_notation): New function.
(main): Detect whether the notation is present, based on the first
character of command. If so, filter the trailing part of the argument
vector through the expand_command_notation function, and use that.
Either way, the effective vector is referenced using the down_argv
variable and that is used for the execvp call.
If an error occurs, the diagnostic refers to the first element of
down_argv rather than the original argv.

* tests/misc/env.sh: Added some test cases. Doesn't probe all the corner
cases. I solemnly declare that I manually tested those corner cases,
like "env :" and "env :{}" and such, and used valgrind for
all the manual testing to be confident that there are no
overruns or uses of uninitialized bytes.

* doc/coreutils.texi: Documented feature. Added discussion about how
env is often used for the hash bang mechanism, and how the feature
relates to this use.
---
 doc/coreutils.texi | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/env.c          | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
 tests/misc/env.sh  | 18 +++++++++++++++
 3 files changed, 143 insertions(+), 2 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 1834e92..9e1cb0c 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -16879,6 +16879,69 @@ env -u EDITOR PATH=/energy -- e=mc2 bar baz
 
 @end itemize
 
+Note that the ability to run commands in a modified environment is built into
+the shell language, using a very similar @samp{@var{variable}=@var{value}}
+syntax; moreover, that syntax allows commands internal to the shell to be run
+in a modified environment, which is not possible with the external
+@command{env}.  Other scripting languages usually also have their own built-in
+mechanisms for manipulating the environment around the execution of a child
+program.  Therefore the external @command{env} executable is rarely needed for
+the purpose of running a command in a modified environment.  Because the
+@command{env} utility uses @env{PATH} to search for @var{command}, it has come
+to be mainly used as a mechanism in "hash bang" scripting. In this usage,
+scripts are written using the incantation @samp{#!/usr/bin/env interp} where
+@var{interp} is the name of some scripting language interpreter. The
+@command{env} utility provides value by searching @env{PATH} for the location
+of the interpreter executable. This allows the interpreter to be installed in
+some chosen location, without that location having to be edited into the hash
+bang scripts which refer to that interpreter.
+
+On some operating systems, the following issue exists: the hash bang
+interpreter mechanism allows only one argument. Therefore, if the @command{env}
+incantation @samp{#!/usr/bin/env interp} is used, it is not possible to pass an
+argument to @samp{interp}, which is a crippling limitation in some
+circumstances requiring clumsy workarounds. To overcome this difficulty, the
+GNU Coreutils version of @command{env} supports a special notation:
+arguments for @var{command} can be embedded in the @var{command} argument
+itself as follows.  If @var{command} begins with the @samp{:} (colon)
+character, then that colon character is removed. The remainder of the
+argument is treated as record of colon-separated fields, and split
+accordingly. For instance if @var{command} is @samp{:foo:--bar:42}, then
+it is split into the fields @samp{foo}, @samp{--bar} and @samp{42}. The
+effective command is then just @samp{foo}. The other two fields will be
+passed as the first two arguments to @samp{foo}, inserted before the
+remaining @var{args}, if @samp{foo} is successfully found using
+@env{PATH} and executed.
+Furthermore, this special supports one more refinement.
+If, after colon splitting, one or more of the fields are
+equal to the character string @samp{@{@}} (open brace, closed brace)
+then the leftmost such field is replaced with the first of the @var{args}
+which follow @var{command}. In this case, that argument is removed from
+@var{args}. If @var{args} is empty, then the field is not replaced.
+
+Example: @command{env} hash bang line for a script executed by the
+fictitious @samp{intercal} interpreter. The @samp{--strict-iso} option
+is passed to the interpreter, and the @samp{--verbose} option is
+passed to the script:
+
+@example
+#!/usr/bin/env :intercal:--strict-iso:@{@}:--verbose
+... script goes here ...
+@end example
+
+When the above hash bang script is invoked with the arguments @samp{alpha} and
+@samp{omega}, @command{env} is invoked with four arguments arguments: the
+argument @samp{:intercal:--strict-iso:@{@}:--verbose}, followed by the
+path name to the above script itself, followed by @samp{alpha} and @samp{omega}.
+The @command{env} will parse the special notation in the command, producing
+the fields @samp{intercal}, @samp{--strict-iso}, @samp{@{@}} and
+@samp{--verbose}. The @samp{@{@}} field is recognized and replaced with
+the first of the remaining arguments, which is the path to the interpreter.
+This argument is then removed form the remaining arguments. Then
+@command{env} searches @env{PATH} for @samp{intercal}. Upon finding it,
+it executes the interpreter with the arguments @samp{--strict-iso},
+the name of the script, @samp{--verbose}, @samp{alpha} and @samp{omega}.
+
 
 The program accepts the following options.  Also see @ref{Common options}.
 Options must precede operands.
diff --git a/src/env.c b/src/env.c
index 63d5c2c..20fafdd 100644
--- a/src/env.c
+++ b/src/env.c
@@ -18,6 +18,7 @@
 
 #include <config.h>
 #include <stdio.h>
+#include <assert.h>
 #include <sys/types.h>
 #include <getopt.h>
 
@@ -70,11 +71,65 @@ Set each NAME to VALUE in the environment and run COMMAND.\n\
 \n\
 A mere - implies -i.  If no COMMAND, print the resulting environment.\n\
 "), stdout);
+      fputs (_("\
+\n\
+COMMAND supports a notation for encoding a command name plus one or more\n\
+arguments. This is useful when env is used in #! (hash bang) scripting.\n\
+Please see the Info documentation for the details.\n\
+"), stdout);
       emit_ancillary_info (PROGRAM_NAME);
     }
   exit (status);
 }
 
+char **
+expand_command_notation(char **argv)
+{
+  char *command = xstrdup(argv[0] + 1), *p, **pp, **nargv;
+  int nf, argc, a, rest = 1;
+
+  for (nf = 1, p = command; *p; p++)
+    {
+      if (*p == ':')
+        nf++;
+    }
+
+  for (argc = 0, pp = argv; *pp; argc++, pp++)
+    ; /* empty */
+
+  argc += nf - 1;
+
+  if ((nargv = malloc((argc + 1) * sizeof *nargv)) == NULL || command == NULL)
+    die (EXIT_FAILURE, errno, _("out of memory"));
+
+  for (a = 0, p = command; ; p++)
+    {
+      char *arg = p;
+      char *end = p + strcspn(p, ":");
+      char ch = *end;
+
+      *end = 0;
+
+      if (rest < 2 && strcmp(arg, "{}") == 0 && argv[rest])
+        arg = argv[rest++];
+
+      nargv[a++] = arg;
+
+      if (ch == ':')
+        {
+          p = end;
+          continue;
+        }
+
+      break;
+    }
+
+  assert (a == nf);
+
+  memcpy(&nargv[a], &argv[rest], sizeof nargv[0] * (argc + 2 - rest - a));
+  return nargv;
+}
+
 int
 main (int argc, char **argv)
 {
@@ -154,9 +209,14 @@ main (int argc, char **argv)
       usage (EXIT_CANCELED);
     }
 
-  execvp (argv[optind], &argv[optind]);
+  char **rest_argv = argv + optind;
+  char **down_argv = (rest_argv[0][0] == ':')
+                     ? expand_command_notation(rest_argv)
+                     : rest_argv;
+
+  execvp (down_argv[0], down_argv);
 
   int exit_status = errno == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE;
-  error (0, errno, "%s", quote (argv[optind]));
+  error (0, errno, "%s", quote (down_argv[0]));
   return exit_status;
 }
diff --git a/tests/misc/env.sh b/tests/misc/env.sh
index f2f6ba8..aeb2b91 100755
--- a/tests/misc/env.sh
+++ b/tests/misc/env.sh
@@ -150,4 +150,22 @@ test "x$(sh -c '\c=d echo fail')" = xpass && #dash 0.5.4 fails so check first
 returns_ 125 env -u a=b true || fail=1
 returns_ 125 env -u '' true || fail=1
 
+# test the special env :command... notation for encoding arguments
+test "$(env :echo)" = "" || fail=1
+test "$(env :echo:)" = "" || fail=1
+test "$(env :echo:a)" = "a" || fail=1
+test "$(env :echo:a:b)" = "a b" || fail=1
+test "$(env :echo:a b)" = "a b" || fail=1
+test "$(env :echo:a: b)" = "a  b" || fail=1
+test "$(env :echo:a:b c d)" = "a b c d" || fail=1
+test "$(env :echo:aa:bb cc dd)" = "aa bb cc dd" || fail=1
+test "$(env :echo:{}:bb cc dd)" = "cc bb dd" || fail=1
+test "$(env :echo:{} cc dd)" = "cc dd" || fail=1
+test "$(env :echo:{}:aa:bb cc dd)" = "cc aa bb dd" || fail=1
+test "$(env :echo:{})" = "{}" || fail=1
+test "$(env :echo:{}:{})" = "{} {}" || fail=1
+test "$(env :echo:{}:a)" = "{} a" || fail=1
+test "$(env :echo:{}:a b)" = "b a" || fail=1
+test "$(env :echo:{}:{} b)" = "b {}" || fail=1
+
 Exit $fail
-- 
2.9.3


From MAILER-DAEMON Sat May 27 06:39:39 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dEZ8F-0002ZE-LO
	for mharc-coreutils@gnu.org; Sat, 27 May 2017 06:39:39 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:49367)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <P@draigBrady.com>) id 1dEZ8D-0002Yg-77
	for coreutils@gnu.org; Sat, 27 May 2017 06:39:38 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <P@draigBrady.com>) id 1dEZ88-0002Tz-B6
	for coreutils@gnu.org; Sat, 27 May 2017 06:39:37 -0400
Received: from mail.magicbluesmoke.com ([82.195.144.49]:43566)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <P@draigBrady.com>) id 1dEZ88-0002Tj-4f
	for coreutils@gnu.org; Sat, 27 May 2017 06:39:32 -0400
Received: from localhost.localdomain (unknown [109.79.160.71])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by mail.magicbluesmoke.com (Postfix) with ESMTPSA id 2725423C;
	Sat, 27 May 2017 11:39:29 +0100 (IST)
Subject: Re: coreutils-8.27 released [stable]
To: Michael Felt <aixtools@gmail.com>, Coreutils <coreutils@gnu.org>
References: <8e8eaed6-2358-e2fe-272d-689101d2b30f@draigBrady.com>
	<CANvxniXzbZoQBDUpmhuT7zsK9d18DnZKCCYRiNDtQabv-E6tWQ@mail.gmail.com>
From: =?UTF-8?Q?P=c3=a1draig_Brady?= <P@draigBrady.com>
Message-ID: <973883a1-e589-13fc-9e26-bd2b6e883e6d@draigBrady.com>
Date: Sat, 27 May 2017 11:39:28 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
	Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <CANvxniXzbZoQBDUpmhuT7zsK9d18DnZKCCYRiNDtQabv-E6tWQ@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 82.195.144.49
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 27 May 2017 10:39:38 -0000

On 25/05/17 02:58, Michael Felt wrote:
> file config.h contains an incorrect file suffix

The reason for that error is because your compiler is not
recognizing the -include option and thus interpreting the
file as a file to compile.

Now I added the -include option when compiling b2sum
in v8.26 as I thought it was standard
(and I checked solaris cc, gcc, clang, icc).
I see that xlc may support this option if invoked as gxlc ?
Also you could change the -include in src/local.mk to -qinclude
which should also work according to the xlc docs.

thanks,
P=C3=A1draig


From MAILER-DAEMON Sat May 27 11:06:33 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dEdIX-0002EA-1f
	for mharc-coreutils@gnu.org; Sat, 27 May 2017 11:06:33 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50244)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <P@draigBrady.com>) id 1dEdIU-0002E3-TK
	for coreutils@gnu.org; Sat, 27 May 2017 11:06:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <P@draigBrady.com>) id 1dEdIQ-0000hd-VL
	for coreutils@gnu.org; Sat, 27 May 2017 11:06:30 -0400
Received: from mail.magicbluesmoke.com ([82.195.144.49]:47070)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <P@draigBrady.com>) id 1dEdIQ-0000hC-Oo
	for coreutils@gnu.org; Sat, 27 May 2017 11:06:26 -0400
Received: from localhost.localdomain (unknown [109.79.160.71])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by mail.magicbluesmoke.com (Postfix) with ESMTPSA id 2BB599C96;
	Sat, 27 May 2017 16:06:24 +0100 (IST)
Subject: Re: [PATCH] env: support encoding of args into command.
To: Kaz Kylheku <962-396-1872@kylheku.com>, coreutils@gnu.org
References: <abc38ce047aa0b6601983350b6993453@mail.kylheku.com>
From: =?UTF-8?Q?P=c3=a1draig_Brady?= <P@draigBrady.com>
Message-ID: <a17e0ff7-5542-c969-7b59-24e8e2cb65b1@draigBrady.com>
Date: Sat, 27 May 2017 16:06:22 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
	Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <abc38ce047aa0b6601983350b6993453@mail.kylheku.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 82.195.144.49
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 27 May 2017 15:06:31 -0000

On 25/05/17 19:15, Kaz Kylheku wrote:
> This is a new feature which allows the command argument of env to encod=
e
> multiple extra arguments, as well as the relocation of the first
> trailing argument among those arguments.

Some useful references about this issue:

https://www.in-ulm.de/~mascheck/various/shebang/#splitting
https://www.freebsd.org/cgi/man.cgi?query=3Denv

Drilling down there shows there was a patch to Linux
proposed in 2004 to split all arguments, but was voted
against by a single person citing compat worries,
but no specific compat issues.
Around the same time BSD changed to processing from splitting
all args to be like Linux for more detailed reasons mentioned in:
https://lists.freebsd.org/pipermail/freebsd-arch/2005-February/003525.htm=
l
I.E. the issue of distinguishing args to the interpreter
from args to the script.

Now the FreeBSD env(1) command supports the -S option
to do splitting much as you've proposed, so I see no need to be different=
.
Could you adjust the patch accordingly?

Also this patch is significant enough that
it would need copyright assignment for inclusion.
Could you start that process?
http://git.sv.gnu.org/gitweb/?p=3Dcoreutils.git;a=3Dblob;f=3DHACKING;hb=3D=
42192c51#l470

thanks!
P=C3=A1draig.


From MAILER-DAEMON Sat May 27 20:30:27 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dEm6E-0008Do-Vu
	for mharc-coreutils@gnu.org; Sat, 27 May 2017 20:30:27 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43777)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <962-396-1872@kylheku.com>) id 1dEm6C-0008De-Jq
	for coreutils@gnu.org; Sat, 27 May 2017 20:30:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <962-396-1872@kylheku.com>) id 1dEm69-0001nL-GJ
	for coreutils@gnu.org; Sat, 27 May 2017 20:30:24 -0400
Received: from smtp-out-so.shaw.ca ([64.59.136.137]:34370)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <962-396-1872@kylheku.com>)
	id 1dEm69-0001jo-Ah
	for coreutils@gnu.org; Sat, 27 May 2017 20:30:21 -0400
Received: from kylheku.com ([70.79.163.252]) by shaw.ca with SMTP
	id Em5wdU1Wayd2DEm5xd5FEl; Sat, 27 May 2017 18:30:10 -0600
X-Authority-Analysis: v=2.2 cv=F5wnTupN c=1 sm=1 tr=0
	a=95A0EdhkF1LMGt25d7h1IQ==:117 a=95A0EdhkF1LMGt25d7h1IQ==:17
	a=IkcTkHD0fZMA:10 a=SMorJkV_YP8A:10 a=tJ8p9aeEuA8A:10
	a=A-FmWyon0LNhA6OaCNIA:9 a=QEXdDO2ut3YA:10
Received: from www-data by kylheku.com with local (Exim 4.72)
	(envelope-from <962-396-1872@kylheku.com>)
	id 1dEm5u-0007Pp-U6; Sat, 27 May 2017 17:30:06 -0700
To: =?UTF-8?Q?P=C3=A1draig_Brady?= <P@draigbrady.com>
Subject: Re: [PATCH] env: support encoding of args into command.
X-PHP-Originating-Script: 501:rcmail.php
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8;
 format=flowed
Content-Transfer-Encoding: 8bit
Date: Sat, 27 May 2017 17:30:06 -0700
From: "Kaz Kylheku (Coreutils)" <962-396-1872@kylheku.com>
Cc: coreutils@gnu.org
In-Reply-To: <a17e0ff7-5542-c969-7b59-24e8e2cb65b1@draigBrady.com>
References: <abc38ce047aa0b6601983350b6993453@mail.kylheku.com>
	<a17e0ff7-5542-c969-7b59-24e8e2cb65b1@draigBrady.com>
Message-ID: <d3dfa3e49761efe291a825efa312ef64@mail.kylheku.com>
X-Sender: 962-396-1872@kylheku.com
User-Agent: Roundcube Webmail/0.9.2
X-CMAE-Envelope: MS4wfDEJMZD2fyMFZdZS+P461aKa589vbfJW4eUalJPz2hM5gQR8sGfud2fjMIKqA447+Y/3RxNjegw1Odip2givzXeIh5v9HO0228l6YIdNbZl1ojC63g4L
	2wYEEkLeSek77qBmAwKIZrKruyeyLovqgFsTOcwjjJT9nU1i8S5r8f1SpoFmr6X9g9uBI8HBWLmDyMHaWl/jg/uc/FxfJwkCJgQ=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 64.59.136.137
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 28 May 2017 00:30:25 -0000

On 27.05.2017 08:06, Pádraig Brady wrote:
> Now the FreeBSD env(1) command supports the -S option
> to do splitting much as you've proposed, so I see no need to be 
> different.
> Could you adjust the patch accordingly?

I think it's probably best to avoid copying FreeBSD here. They have
created a mess with too many requirements. Their -S feature
has quitespace delimiting, quoting, escaping of quotes,
C-like character escape sequences: \n, \r, \f, ...
and ${PARAM} environment variable expansion. A little shell
language seems to be brewing inside the FreeBSD env program.
What's it all for?

Yet, for all the "bells and whistles", they are missing the
{} feature to insert the first argument (the name of the script
in hash bang dispatch) among the generated arguments,
something which can't be achieved with any combination of
environment variable substitutions. It is useful because
it allows the hash bang to specify some arguments after the
script (which could be arguments belonging to the script
rather than to the interpreter, for instance).

Let's look at the delimiting requirement. Using spaces
perpetrates a clever visual ruse. The command line:

     $ /usr/bin/env -S a b c

translates directly to hash bang:

     #!/usr/bin/env -S a b c

the semantics is different, of course; here the string " a b c"
is one argument to -S, subject to splitting. It's
understandable why they have it this way, but I believe
it is fine not to play this sort of trick and make the
mechanism have a visually explicit syntax.

I chose the colon character for a very good reason: it is the
PATH separator. Which means, it doesn't occur the command
argument in any correct usage of env, and is therefore available
as a separator.

I don't envision a need to support quoting the : character
for inclusion in an argument.

The main reason to include : in an argument is to support
the -P altpath feature of env, another FreeBSD extension.
This is also overdesigned.  If you don't know
where the program is, rely on PATH. If you know where
the program is, put its exact path into the hash bang
script, and don't use the env utility.
The situation "I don't know where the software might be
installed, but it's in one of these
several locations which are not in the PATH" is fairly contrived,
except in one way: when it is known that the software is in
one of the secure, default system locations for programs such
as /bin:/usr/bin, but the PATH could have been altered not
to look in these locations first.

Instead of -P altpath, a single letter option with no argument
can indicate that PATH is to be reset to the secure default,
so that the correct program is found, or else env fails.

Bascially I'm completely against almost every aspect of this
-S design; and I suspect the POSIX standardization people
(Austion Group) won't adopt it, either, so it will forever
remain just a FreeBSD feature (and we can help keep it that
way by not copying it).



From MAILER-DAEMON Mon May 29 07:29:43 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dFIrn-0005t7-PE
	for mharc-coreutils@gnu.org; Mon, 29 May 2017 07:29:43 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:35747)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1dFIrl-0005sZ-3f
	for coreutils@gnu.org; Mon, 29 May 2017 07:29:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1dFIrh-000655-Vt
	for coreutils@gnu.org; Mon, 29 May 2017 07:29:41 -0400
Received: from mx1.redhat.com ([209.132.183.28]:60328)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <eblake@redhat.com>) id 1dFIrh-00064Z-M7
	for coreutils@gnu.org; Mon, 29 May 2017 07:29:37 -0400
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com
	[10.5.11.16])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.redhat.com (Postfix) with ESMTPS id 81BC5C056827;
	Mon, 29 May 2017 11:29:35 +0000 (UTC)
DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 81BC5C056827
Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com;
	dmarc=none (p=none dis=none) header.from=redhat.com
Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com;
	spf=pass smtp.mailfrom=eblake@redhat.com
DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 81BC5C056827
Received: from [10.10.120.133] (ovpn-120-133.rdu2.redhat.com [10.10.120.133])
	by smtp.corp.redhat.com (Postfix) with ESMTP id D184C5C542;
	Mon, 29 May 2017 11:29:34 +0000 (UTC)
Subject: Re: [PATCH] env: support encoding of args into command.
To: "Kaz Kylheku (Coreutils)" <962-396-1872@kylheku.com>,
	=?UTF-8?Q?P=c3=a1draig_Brady?= <P@draigbrady.com>
References: <abc38ce047aa0b6601983350b6993453@mail.kylheku.com>
	<a17e0ff7-5542-c969-7b59-24e8e2cb65b1@draigBrady.com>
	<d3dfa3e49761efe291a825efa312ef64@mail.kylheku.com>
Cc: coreutils@gnu.org
From: Eric Blake <eblake@redhat.com>
Openpgp: url=http://people.redhat.com/eblake/eblake.gpg
Organization: Red Hat, Inc.
Message-ID: <15b3a417-36ba-0028-7049-4ae74be87f75@redhat.com>
Date: Mon, 29 May 2017 06:29:33 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
	Thunderbird/52.1.0
MIME-Version: 1.0
In-Reply-To: <d3dfa3e49761efe291a825efa312ef64@mail.kylheku.com>
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="tvo7IE9XLBINM3D5p1hUDn9KVBB6P0oFD"
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
	(mx1.redhat.com [10.5.110.32]);
	Mon, 29 May 2017 11:29:35 +0000 (UTC)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 209.132.183.28
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 29 May 2017 11:29:42 -0000

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--tvo7IE9XLBINM3D5p1hUDn9KVBB6P0oFD
From: Eric Blake <eblake@redhat.com>
To: "Kaz Kylheku (Coreutils)" <962-396-1872@kylheku.com>,
 =?UTF-8?Q?P=c3=a1draig_Brady?= <P@draigbrady.com>
Cc: coreutils@gnu.org
Message-ID: <15b3a417-36ba-0028-7049-4ae74be87f75@redhat.com>
Subject: Re: [PATCH] env: support encoding of args into command.
References: <abc38ce047aa0b6601983350b6993453@mail.kylheku.com>
 <a17e0ff7-5542-c969-7b59-24e8e2cb65b1@draigBrady.com>
 <d3dfa3e49761efe291a825efa312ef64@mail.kylheku.com>
In-Reply-To: <d3dfa3e49761efe291a825efa312ef64@mail.kylheku.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 05/27/2017 07:30 PM, Kaz Kylheku (Coreutils) wrote:

>=20
> Bascially I'm completely against almost every aspect of this
> -S design; and I suspect the POSIX standardization people
> (Austion Group) won't adopt it, either, so it will forever
> remain just a FreeBSD feature (and we can help keep it that
> way by not copying it).

The Austin Group has already declared that #! is non-portable, and that
portable scripts can't use it, BECAUSE of the wide variety in how
kernels handle it and the small limits on how much you can cram in that
line.  So there is nothing TO standardize, and it doesn't matter what we
do here from the POSIX front.  But it DOES help to copy an existing
implementation, rather than invent YET ANOTHER syntax.  So even if you
think the FreeBSD feature is warty, it's still better to at least have a
mode that matches it for feature parity.

--=20
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


--tvo7IE9XLBINM3D5p1hUDn9KVBB6P0oFD
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJZLAYdAAoJEKeha0olJ0Nqo4UH/3njXZGki50NNBQGYKKP0pME
kUt9LFcMQ6XHWTFihr2TWkwy0/8B0e8UZ5hNOGAzlGbkRi5c0tEW0c02sHb66wzp
Lviaa6l0SFgi8mzAA1ERswGPGapxovr0edwtQZjjvyr0zGVkxrsFs5URk37JUQsH
lygoKf+r6hy6wUa4R0D0lyfDvtB5RqzjobQMGyP4JQG457RptmhdVf53tIovtWcP
TL4cAtUja5wylT/dQZSWGjy0BNgHarht4wRble849SbDcyNPzAzew7P9ghavK7th
RIoAXEumZNXJwIu3gt2p+sYw3t+s9IH3CrAt6+0V4TFa+l2HRJy1xLpqjwzA91s=
=RC/s
-----END PGP SIGNATURE-----

--tvo7IE9XLBINM3D5p1hUDn9KVBB6P0oFD--


From MAILER-DAEMON Mon May 29 08:22:07 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dFJgU-0006cz-Uf
	for mharc-coreutils@gnu.org; Mon, 29 May 2017 08:22:06 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:46675)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <skisela@redhat.com>) id 1dFJgS-0006bD-Bu
	for coreutils@gnu.org; Mon, 29 May 2017 08:22:05 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <skisela@redhat.com>) id 1dFJgP-0004rk-7S
	for coreutils@gnu.org; Mon, 29 May 2017 08:22:04 -0400
Received: from mail-wm0-f50.google.com ([74.125.82.50]:36227)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <skisela@redhat.com>) id 1dFJgP-0004re-02
	for coreutils@gnu.org; Mon, 29 May 2017 08:22:01 -0400
Received: by mail-wm0-f50.google.com with SMTP id 7so53827455wmo.1
	for <coreutils@gnu.org>; Mon, 29 May 2017 05:22:00 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:mime-version:in-reply-to:references:from:date
	:message-id:subject:to:cc;
	bh=JeLLq18gGGemqoSzEh7F6YygK7vn37n0hea5vBk7mUs=;
	b=DnsTWbBl0TOU8BvWOJvRozRVYdAz5UnDSWapSHPoNpLcFfKttmYDizys0gle6orRHi
	mFRdy4Z4VYa6tMJfXMahZ4KFAfdFcygNtBLh+/eWHzS9s3tJNe+b/KLDB0u4jNcVX5t2
	caYqMq5/+/9xz1NoqXI+FxZVsawYUGVNpc6cLT7WLLuPpjKlPL1FBlUaw34vKPnxFVQn
	IwHhZGmdE6e4p9dDF4OwzNaBOhWNiep5XY4fyYO0ZE0MPw3tumNN2al03AZ8AN0zmhW4
	BdXVGsUl40Jrd/AiEMrCQB5iCKQ4pn/v0Sw/0t12DRvFcjXdXKp4NXXbnKkmrn212C3b
	vEgw==
X-Gm-Message-State: AODbwcB434MQ8aZB1ATUoU5upLtQEp8IEXiMYvQZ/PVmzPuGEJPcTXy2
	+t7S1kW3goRPWnOQJdB3zFAiSWrXBtTu
X-Received: by 10.28.178.207 with SMTP id b198mr10588453wmf.0.1496060519077;
	Mon, 29 May 2017 05:21:59 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.223.161.130 with HTTP; Mon, 29 May 2017 05:21:58 -0700 (PDT)
In-Reply-To: <20170426155911.GA28815@gmail.com>
References: <CAKsWQOpZa480BJRKxLmkD-7JpYxYDvatU17Rm7bYO0sND_jVQw@mail.gmail.com>
	<20170426155911.GA28815@gmail.com>
From: Sebastian Kisela <skisela@redhat.com>
Date: Mon, 29 May 2017 14:21:58 +0200
Message-ID: <CAKsWQOpBPT24+=Oj09bFiErATScz=+4N87R_d8xETB+xG+_yjQ@mail.gmail.com>
Subject: Re: [PATCH] runcon: add --no-new-privs option
To: Assaf Gordon <assafgordon@gmail.com>
Cc: coreutils@gnu.org
Content-Type: multipart/mixed; boundary="001a114428f4cd982b0550a8bb07"
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 74.125.82.50
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 29 May 2017 12:22:05 -0000

--001a114428f4cd982b0550a8bb07
Content-Type: text/plain; charset="UTF-8"

If this feature is primarily for testing purposes,
> wouldn't using setpriv from util-linux achieve the same
> without adding code?
>
>    setpriv --no-new-privs \
>        runcon -t svirt_lxc_net_t /bin/sh
>

Nice! I did not know about this one!

Do you think it would be beneficial to mention that in the info
documentation?

Patch for the info documentation attached.

best regards,
Sebastian.

--001a114428f4cd982b0550a8bb07
Content-Type: text/x-patch; charset="UTF-8"; name="runcon-no-new-privs-info.patch"
Content-Disposition: attachment; filename="runcon-no-new-privs-info.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_j3a3sr1s0

RnJvbSBhYTUyMjI4MmM4MWEwNzM5MWVmOWQ4M2FhM2FlMTg2ODMzOGZjYTVhIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBTZWJhc3RpYW4gS2lzZWxhIDxza2lzZWxhQHJlZGhhdC5jb20+
CkRhdGU6IE1vbiwgMjkgTWF5IDIwMTcgMTQ6MTc6MDcgKzAyMDAKU3ViamVjdDogW1BBVENIXSBy
dW5jb246IG1lbnRpb24gbm8tbmV3LXByaXZzIGZlYXR1cmUgcG9zc2libGUgdGhyb3VnaCBzZXRw
cml2CgoqIHJ1bmNvbiBtb2RpZnkgdXNhZ2UgaW5mbyBkb2N1bWVudGF0aW9uCiogUmVmZXJlbmNl
cyBodHRwczovL2J1Z3ppbGxhLnJlZGhhdC5jb20vMTM2MDkwMwotLS0KIGRvYy9jb3JldXRpbHMu
dGV4aSB8IDQgKysrKwogZ251bGliICAgICAgICAgICAgIHwgMiArLQogMiBmaWxlcyBjaGFuZ2Vk
LCA1IGluc2VydGlvbnMoKyksIDEgZGVsZXRpb24oLSkKCmRpZmYgLS1naXQgYS9kb2MvY29yZXV0
aWxzLnRleGkgYi9kb2MvY29yZXV0aWxzLnRleGkKaW5kZXggMTgzNGU5Mi4uM2I0MDZhZSAxMDA2
NDQKLS0tIGEvZG9jL2NvcmV1dGlscy50ZXhpCisrKyBiL2RvYy9jb3JldXRpbHMudGV4aQpAQCAt
MTY1ODYsNiArMTY1ODYsMTAgQEAgc2VjdXJpdHkgY29udGV4dC4KIAogVGhlIHByb2dyYW0gYWNj
ZXB0cyB0aGUgZm9sbG93aW5nIG9wdGlvbnMuICBBbHNvIHNlZSBAcmVme0NvbW1vbiBvcHRpb25z
fS4KIAorVXNlICdzZXRwcml2IC0tbm8tbmV3LXByaXZzIHJ1bmNvbiAuLi4nIHRvIHNldCBOT19O
RVdfUFJJVlMgYml0LCB0byBkaXNhbGxvdyB1c2FnZSBvZiBjb250ZXh0IHdpdGggbW9yZSBwcml2
aWxlZ2VzIHRoYW4gdGhlIHByb2Nlc3MgaGFzIG5vcm1hbGx5LgorCitUaGUgc2V0cHJpdiBjb21t
YW5kIGlzIHBhcnQgb2YgdGhlIHV0aWwtbGludXggcGFja2FnZSBhbmQgaXMgYXZhaWxhYmxlIGZy
b20gTGludXggS2VybmVsIEFyY2hpdmUgKGZ0cDovL2Z0cC5rZXJuZWwub3JnL3B1Yi9saW51eC91
dGlscy91dGlsLWxpbnV4L+KfqQorCiBAdGFibGUgQHNhbXAKIAogQGl0ZW0gLWMKZGlmZiAtLWdp
dCBhL2dudWxpYiBiL2dudWxpYgppbmRleCBlZmI4NDIxLi44ZWRlYmZlIDE2MDAwMAotLS0gYS9n
bnVsaWIKKysrIGIvZ251bGliCkBAIC0xICsxIEBACi1TdWJwcm9qZWN0IGNvbW1pdCBlZmI4NDIx
NGFjMTQ3NDkxODhhYjgyOTRhNTJiNGU5MTQ3NWMxM2I2CitTdWJwcm9qZWN0IGNvbW1pdCA4ZWRl
YmZlNmY5N2QwZTM3OGQwNDJhY2NiMjQ3NWEzMmE1M2YxMDBmCi0tIAoyLjkuNAoK
--001a114428f4cd982b0550a8bb07--


From MAILER-DAEMON Mon May 29 15:45:41 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dFQbl-00075f-C4
	for mharc-coreutils@gnu.org; Mon, 29 May 2017 15:45:41 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43550)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <P@draigBrady.com>) id 1dFQbi-00073a-1X
	for coreutils@gnu.org; Mon, 29 May 2017 15:45:39 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <P@draigBrady.com>) id 1dFQbf-0004KV-Fc
	for coreutils@gnu.org; Mon, 29 May 2017 15:45:38 -0400
Received: from mail.magicbluesmoke.com ([82.195.144.49]:43456)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <P@draigBrady.com>) id 1dFQbf-0004K3-83
	for coreutils@gnu.org; Mon, 29 May 2017 15:45:35 -0400
Received: from localhost.localdomain (mobile-166-137-177-171.mycingular.net
	[166.137.177.171])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by mail.magicbluesmoke.com (Postfix) with ESMTPSA id 903C7984A;
	Mon, 29 May 2017 20:45:31 +0100 (IST)
Subject: Re: [PATCH] runcon: add --no-new-privs option
To: Sebastian Kisela <skisela@redhat.com>, Assaf Gordon <assafgordon@gmail.com>
References: <CAKsWQOpZa480BJRKxLmkD-7JpYxYDvatU17Rm7bYO0sND_jVQw@mail.gmail.com>
	<20170426155911.GA28815@gmail.com>
	<CAKsWQOpBPT24+=Oj09bFiErATScz=+4N87R_d8xETB+xG+_yjQ@mail.gmail.com>
Cc: coreutils@gnu.org
From: =?UTF-8?Q?P=c3=a1draig_Brady?= <P@draigBrady.com>
Message-ID: <fee16b21-1d7e-ad06-7f40-56a024186a51@draigBrady.com>
Date: Mon, 29 May 2017 12:45:28 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
	Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <CAKsWQOpBPT24+=Oj09bFiErATScz=+4N87R_d8xETB+xG+_yjQ@mail.gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 82.195.144.49
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 29 May 2017 19:45:39 -0000

On 29/05/17 05:21, Sebastian Kisela wrote:
> From aa522282c81a07391ef9d83aa3ae1868338fca5a Mon Sep 17 00:00:00 2001
> From: Sebastian Kisela <skisela@redhat.com>
> Date: Mon, 29 May 2017 14:17:07 +0200
> Subject: [PATCH] runcon: mention no-new-privs feature possible through =
setpriv
>=20
> * runcon modify usage info documentation
> * References https://bugzilla.redhat.com/1360903
> ---
>  doc/coreutils.texi | 4 ++++
>  gnulib             | 2 +-
>  2 files changed, 5 insertions(+), 1 deletion(-)
>=20
> diff --git a/doc/coreutils.texi b/doc/coreutils.texi
> index 1834e92..3b406ae 100644
> --- a/doc/coreutils.texi
> +++ b/doc/coreutils.texi
> @@ -16586,6 +16586,10 @@ security context.
> =20
>  The program accepts the following options.  Also see @ref{Common optio=
ns}.
> =20
> +Use 'setpriv --no-new-privs runcon ...' to set NO_NEW_PRIVS bit, to di=
sallow usage of context with more privileges than the process has normall=
y.
> +
> +The setpriv command is part of the util-linux package and is available=
 from Linux Kernel Archive (ftp://ftp.kernel.org/pub/linux/utils/util-lin=
ux/=E2=9F=A9
> +

Adjusted and applied.
http://git.sv.gnu.org/gitweb/?p=3Dcoreutils.git;a=3Dcommitdiff;h=3Dv8.27-=
37-g6ebaf81

>  @table @samp
> =20
>  @item -c
> diff --git a/gnulib b/gnulib
> index efb8421..8edebfe 160000
> --- a/gnulib
> +++ b/gnulib
> @@ -1 +1 @@
> -Subproject commit efb84214ac14749188ab8294a52b4e91475c13b6
> +Subproject commit 8edebfe6f97d0e378d042accb2475a32a53f100f

Note you needed to do a `git submodule update` after your git pull,
to avoid this vestigial local change.

thanks,
P=C3=A1draig


From MAILER-DAEMON Mon May 29 22:37:59 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dFX2l-0007or-CM
	for mharc-coreutils@gnu.org; Mon, 29 May 2017 22:37:59 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:52681)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <962-396-1872@kylheku.com>) id 1dFX2i-0007oQ-Dp
	for coreutils@gnu.org; Mon, 29 May 2017 22:37:57 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <962-396-1872@kylheku.com>) id 1dFX2e-00073I-F8
	for coreutils@gnu.org; Mon, 29 May 2017 22:37:56 -0400
Received: from smtp-out-no.shaw.ca ([64.59.134.13]:42840)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <962-396-1872@kylheku.com>)
	id 1dFX2e-00072j-8m
	for coreutils@gnu.org; Mon, 29 May 2017 22:37:52 -0400
Received: from kylheku.com ([70.79.163.252]) by shaw.ca with SMTP
	id FX2TdWGO2ETFpFX2Ud8gkB; Mon, 29 May 2017 20:37:43 -0600
X-Authority-Analysis: v=2.2 cv=dZbw5Tfe c=1 sm=1 tr=0
	a=95A0EdhkF1LMGt25d7h1IQ==:117 a=95A0EdhkF1LMGt25d7h1IQ==:17
	a=IkcTkHD0fZMA:10 a=SMorJkV_YP8A:10 a=tJ8p9aeEuA8A:10
	a=cWEwoG4biAYwJ9g4zr8A:9 a=QEXdDO2ut3YA:10
Received: from www-data by kylheku.com with local (Exim 4.72)
	(envelope-from <962-396-1872@kylheku.com>) id 1dFX2S-0007ZK-1l
	for coreutils@gnu.org; Mon, 29 May 2017 19:37:40 -0700
To: coreutils@gnu.org
Subject: Re: [PATCH] env: support encoding of args into command.
X-PHP-Originating-Script: 501:rcmail.php
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8;
 format=flowed
Content-Transfer-Encoding: quoted-printable
Date: Mon, 29 May 2017 19:37:39 -0700
From: "Kaz Kylheku (Coreutils)" <962-396-1872@kylheku.com>
In-Reply-To: <15b3a417-36ba-0028-7049-4ae74be87f75@redhat.com>
References: <abc38ce047aa0b6601983350b6993453@mail.kylheku.com>
	<a17e0ff7-5542-c969-7b59-24e8e2cb65b1@draigBrady.com>
	<d3dfa3e49761efe291a825efa312ef64@mail.kylheku.com>
	<15b3a417-36ba-0028-7049-4ae74be87f75@redhat.com>
Message-ID: <646a551e2b7036bb52aef026fb1333f1@mail.kylheku.com>
X-Sender: 962-396-1872@kylheku.com
User-Agent: Roundcube Webmail/0.9.2
X-CMAE-Envelope: MS4wfAUfckb1czuYdGFWPwvuMatS6RcVP/z87qxlsgwTuj8rtDg00p/8JQD+9iU2aJDEhqIVMtbaCWN5iMZTPSJ7oTH1kQO9MVLkg6Ive9QkzS91ljdKLTFh
	U5Rdx5R//aJy2WIWnkpDd+1qizz3uKRvwvc+Agniu3cRJe/QR85YLBgJ
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From: 64.59.134.13
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 30 May 2017 02:37:57 -0000

On 29.05.2017 04:29, Eric Blake wrote:
> On 05/27/2017 07:30 PM, Kaz Kylheku (Coreutils) wrote:
>=20
>>=20
>> Bascially I'm completely against almost every aspect of this
>> -S design; and I suspect the POSIX standardization people
>> (Austion Group) won't adopt it, either, so it will forever
>> remain just a FreeBSD feature (and we can help keep it that
>> way by not copying it).
>=20
> The Austin Group has already declared that #! is non-portable, and that
> portable scripts can't use it, BECAUSE of the wide variety in how
> kernels handle it and the small limits on how much you can cram in that
> line.

Gentleman, please disregard the patch.

I don't care about it any more because I have discovered a
hack which makes it pointless.

With excellent language-level backward compatibility, a given
scripting language interpreter "interp" can provide support
for being invoked in the following manner:

   #!/usr/bin/env interp\000trailing material

Here \000 represents a literal embedded null byte.

So, of course, env receives arg[1] as "interp"
and finds the interpreter properly.  This is the case
whether the kernel stops reading the string after the null,
or wheter the kernel passes the character array
"interp\000trailing material" as argv[1] to env.
either way, env only sees "interp".

The interpreter can then open the script and read the full line,
look for the null byte, and give a meaning to "trailing material".

The interpreter can, in that space, implement the equivalent
of my argument delimiting approach, or the more elaborate one
taken in BSD's env -S.

The notation is very space efficient: just one delimiting character
which positively requires no escaping.

It doesn't require on adding a second line to the script for encoding
the material, which can change the meaning of existing scripts.

It also potentially defeats limitations on hash bang line size.
Why? Because the only requirement which has to be met is that the
null byte occurs within the header size limit! Not the entire hash
bang line.

The programmer is not relying on the hash bang mechanism to pass
anything after the null byte through the command line, so if any
of it is cut off, that is immaterial.

So far, I have tried this on Darwin, Linux, Solaris and Cygwin:
works fine!

A possible objection is that every interpreter has to implement its
own hack for recognizing the material after the null byte and
doing something. The solution for that, of course, is to provide
a library function for dealing with it: a function which takes
(argc, argv), and index of which argv[] is the script name,
and returns a transformed (argc, argv).

The thing to do is to develop develop that library function to make
it easy for interpreter writers to just "drop in".






From MAILER-DAEMON Tue May 30 08:25:14 2017
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1dFgD4-0002AK-KD
	for mharc-coreutils@gnu.org; Tue, 30 May 2017 08:25:14 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:53674)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1dFgCy-00026T-Vb
	for coreutils@gnu.org; Tue, 30 May 2017 08:25:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eblake@redhat.com>) id 1dFgCv-0007Mu-RN
	for coreutils@gnu.org; Tue, 30 May 2017 08:25:08 -0400
Received: from mx1.redhat.com ([209.132.183.28]:45594)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <eblake@redhat.com>) id 1dFgCv-0007MS-Ez
	for coreutils@gnu.org; Tue, 30 May 2017 08:25:05 -0400
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com
	[10.5.11.16])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.redhat.com (Postfix) with ESMTPS id 2EB2C81245;
	Tue, 30 May 2017 12:25:02 +0000 (UTC)
DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2EB2C81245
Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com;
	dmarc=none (p=none dis=none) header.from=redhat.com
Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com;
	spf=pass smtp.mailfrom=eblake@redhat.com
DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2EB2C81245
Received: from [10.10.120.133] (ovpn-120-133.rdu2.redhat.com [10.10.120.133])
	by smtp.corp.redhat.com (Postfix) with ESMTP id BBB6717242;
	Tue, 30 May 2017 12:25:01 +0000 (UTC)
Subject: Re: [PATCH] env: support encoding of args into command.
To: "Kaz Kylheku (Coreutils)" <962-396-1872@kylheku.com>, coreutils@gnu.org
References: <abc38ce047aa0b6601983350b6993453@mail.kylheku.com>
	<a17e0ff7-5542-c969-7b59-24e8e2cb65b1@draigBrady.com>
	<d3dfa3e49761efe291a825efa312ef64@mail.kylheku.com>
	<15b3a417-36ba-0028-7049-4ae74be87f75@redhat.com>
	<646a551e2b7036bb52aef026fb1333f1@mail.kylheku.com>
From: Eric Blake <eblake@redhat.com>
Openpgp: url=http://people.redhat.com/eblake/eblake.gpg
Organization: Red Hat, Inc.
Message-ID: <251f25b8-6a76-d39a-3f1b-434c76ab8d40@redhat.com>
Date: Tue, 30 May 2017 07:25:00 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
	Thunderbird/52.1.0
MIME-Version: 1.0
In-Reply-To: <646a551e2b7036bb52aef026fb1333f1@mail.kylheku.com>
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="gKtbDMuAjWk6bqB2NfIKIkRXB7q2JIhpO"
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
	(mx1.redhat.com [10.5.110.25]);
	Tue, 30 May 2017 12:25:02 +0000 (UTC)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-Received-From: 209.132.183.28
X-Content-Filtered-By: Mailman/MimeDel 2.1.21
X-BeenThere: coreutils@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: GNU coreutils General Discussion <coreutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/coreutils/>
List-Post: <mailto:coreutils@gnu.org>
List-Help: <mailto:coreutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/coreutils>,
	<mailto:coreutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 30 May 2017 12:25:13 -0000

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--gKtbDMuAjWk6bqB2NfIKIkRXB7q2JIhpO
From: Eric Blake <eblake@redhat.com>
To: "Kaz Kylheku (Coreutils)" <962-396-1872@kylheku.com>, coreutils@gnu.org
Message-ID: <251f25b8-6a76-d39a-3f1b-434c76ab8d40@redhat.com>
Subject: Re: [PATCH] env: support encoding of args into command.
References: <abc38ce047aa0b6601983350b6993453@mail.kylheku.com>
 <a17e0ff7-5542-c969-7b59-24e8e2cb65b1@draigBrady.com>
 <d3dfa3e49761efe291a825efa312ef64@mail.kylheku.com>
 <15b3a417-36ba-0028-7049-4ae74be87f75@redhat.com>
 <646a551e2b7036bb52aef026fb1333f1@mail.kylheku.com>
In-Reply-To: <646a551e2b7036bb52aef026fb1333f1@mail.kylheku.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 05/29/2017 09:37 PM, Kaz Kylheku (Coreutils) wrote:
> With excellent language-level backward compatibility, a given
> scripting language interpreter "interp" can provide support
> for being invoked in the following manner:
>=20
>   #!/usr/bin/env interp\000trailing material

I'm glad that hack works for you.

> A possible objection is that every interpreter has to implement its
> own hack for recognizing the material after the null byte

Another objection: this hack FORCES the file to be treated as binary (a
text file cannot contain NUL bytes), so it becomes very awkward to
process the file via usual means (editors may give you grief about the
embedded NUL, tools like sed, grep, and awk may corrupt your file or
give you unexpected output [although the GNU tools try to allow NUL
bytes where possible], and even shells may refuse to run your script
because they detect a NUL byte).  Not insurmountable, but worth thinking
about the consequences before relying on the hack.

--=20
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


--gKtbDMuAjWk6bqB2NfIKIkRXB7q2JIhpO
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJZLWScAAoJEKeha0olJ0NqITcIAI/69JIsa1LH5lGbM9DscJYd
Uabz0HwQ2UYI86u7OjE8/99M2v1TDb3824cBXDVtkXWccIlrfYQ8k+kfFC+g//wr
kwPGfEjy4EL11BlIFgFm1WnfUVxhupDTqTwYS2yYx4THByO9oUBgGR2oCjHoX1y2
HIhFtb7UTTkjCKpXbq7JqolADE4XN3XptS+mm4GtLqRfDDL02GAOuiZfzsBqH3KF
4gOhlMMgbvk0OBP1gTMKOdqILQnFNXgXxXVXKPt24NqjmUdKh9LSV/vHR8m3ddoQ
XuPlTkcxcmi2jcI4k9m7hrvWvB8xAgFc7PExCz9fVEwHIVIFS50XN/wTRCm6HSc=
=719z
-----END PGP SIGNATURE-----

--gKtbDMuAjWk6bqB2NfIKIkRXB7q2JIhpO--


