Assaf Gordon <assafgordon@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 12964) by debbugs.gnu.org; 10 Oct 2018 09:03:16 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 10 05:03:16 2018 Received: from localhost ([127.0.0.1]:42896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1gAAOh-0001NS-Su for submit <at> debbugs.gnu.org; Wed, 10 Oct 2018 05:03:16 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:50623) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <mail@HIDDEN>) id 1gAAOg-0001NF-Bn for 12964 <at> debbugs.gnu.org; Wed, 10 Oct 2018 05:03:14 -0400 Received: from [10.0.2.15] ([91.1.210.52]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MjjGV-1fQ9bc14RP-00lB07; Wed, 10 Oct 2018 11:03:07 +0200 Received: from [10.0.2.15] ([91.1.210.52]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MjjGV-1fQ9bc14RP-00lB07; Wed, 10 Oct 2018 11:03:07 +0200 Subject: Re: bug#12964: [PATCH] printenv: -n option added -- show names of variables. To: Assaf Gordon <assafgordon@HIDDEN>, Van de Bugger <van.de.bugger@HIDDEN>, 12964 <at> debbugs.gnu.org References: <1353624141.3382.3.camel@HIDDEN> <f6e24283-b604-fe93-92af-62817607c9ef@HIDDEN> From: Bernhard Voelker <mail@HIDDEN> Message-ID: <87f3fc0e-f348-88c2-2af2-eaacd4be6453@HIDDEN> Date: Wed, 10 Oct 2018 11:03:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <f6e24283-b604-fe93-92af-62817607c9ef@HIDDEN> Content-Type: text/plain; charset=utf-8 Content-Language: de-DE-1901 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:nTugTrJCH0FGZwSfiM/Mq0TcPJI6G3ZW2+iQu/AxaOzYcz48LhJ 2t50EcdeaqGJM8OVfWm9sqnDxdP57VWLnHPIpsQHhLtOwz5a0E1nZK+Bm0w1UgL2eErVkWK CSwLXMfoNt9zxi8SPgNprw2Na/QIMk54LNLU51pFvC0wCmSGZ02UgxR3I6i8ZgbgNa2CGSs nw8xPhhXNUgXehXC8XeVA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V01:K0:w397ASK7P7k=:9XNIQPbCUvoTu7/RWRnB75 kdlh3JPdGcKL50fvwvJXIeXvWVy0BVMcczOMRxn07iTz7JaLl6Epql7xUNNj5hi/o9CjnHfQJ emSROiWq29leNbM+XdZ0DABoR4Uwr6pZTRMzU/lC2uECGFNAqyN5m5TbBhljcHy0gdBgMqV0S D3L/D+/X1fyiFl6j/M7UBN0k8h4K6FQFkduyn/3pHQmM+7QnCWaRx7gxt2wFvgborA8E2t3nY 2tJli/mdNzm0W4mTij5obIFk21kI5Ppoy30itjhoKQbfcNYfnhVDj/av6zx9y8mY1Cvm7BfSW DUbPvIM09ziEsqG+VPTWg3iOpGDnWgUm9IIMYNia1nf0bSC//2dOKKSGrB/IjyThMohFk44Ag je52HiEj1T+hFV9MCTU2hD02JQq2uj/MlXYBFhm9LeSFvthw9qHEYWgvyS1pWu3CPF3CD3PwN Mnl2JOw1n/b1nug5pBDneXnOF7R2oFOTQaGWVoG4A4ID86FSjyKY7HctKLvb9ViQccDvzlwff 2uVhIGn9Q/+f2pba+1oUKw+oUwPqDF9kUsygHiPrMfYOtFQ3gkkMIgCNScE4li5R6z2v5eqoi dPzPPIXxw+AHBsHUxOR1Lji5qSX5XcXBmML9SvXj/oOTgX8oYhgeBOB0FU3XpSfgekEt4vszG 4DmH5+MNx/SwRZuAqFKat+vV/CVsT8f6UcrSooNZglaffcnV0OYp1zTyIjCA4LgPgBYjVkdNN FIeeSDgXzTwHPSEx X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 12964 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On 10/9/18 11:33 PM, Assaf Gordon wrote: > With your patch, using "printenv -n VARNAME" adds > the variable name to the output. e.g.: > > $ printenv HOME > /home/gordon > > $ printenv -n HOME > HOME=/home/gordon > > From a cursory look this seems like a non-standard extension > that is not available in any other 'printenv' implementations. This feature looks like it should be possible to write out the current settings to a file which could later be sourced in: printenv -n VAR > file and in another shell (to get VAR back): . file I'm afraid this is problematic once the value of a variable starts to have funny characters, even a simple blank ' ' already screws things up. For this kind of save/restore, -n would need to do correct shell quoting. Have a nice day, Berny
bug-coreutils@HIDDEN
:bug#12964
; Package coreutils
.
Full text available.Received: (at 12964) by debbugs.gnu.org; 9 Oct 2018 21:33:42 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 09 17:33:42 2018 Received: from localhost ([127.0.0.1]:42660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1g9zdO-0005fZ-Il for submit <at> debbugs.gnu.org; Tue, 09 Oct 2018 17:33:42 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:45512) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <assafgordon@HIDDEN>) id 1g9zdN-0005fI-Fj for 12964 <at> debbugs.gnu.org; Tue, 09 Oct 2018 17:33:41 -0400 Received: by mail-io1-f66.google.com with SMTP id e12-v6so2334331iok.12 for <12964 <at> debbugs.gnu.org>; Tue, 09 Oct 2018 14:33:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=drCZOHzTchjTQb55pKymUe0qVlAy3/5kczV1PQd0IiI=; b=ieF6UkWv+CIDJpQAxZf5aCTpzo7gSMWVZAUEspv3XIYWy21BjQ08yTI/4L4TmMdiKF E3gCm6vwA0sLdLetMuCD+BossVpuHLldaCZ3rbOPb4Y/PrQMtBMOXFL21rjNWY2G1END ncNJ/tvBggiNZqzC9AuUP126DXxsJGjjpwI7jnVXg5U/lEazPD9/jW4Jm8vL4t3w37ZC JzaR59BGmBQnCwXLEjZXr8sjVR/t9kTHQ2pX3o8eF4MMH8m3R/Ud8O3ttrYayMCaZf1L EJeUEdeGVtuQNs3/UM9oopvhX1BeA8Jy7+nGgfmd7IUToACdYzIUHi0kAG6Zlu52Sqna v49g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=drCZOHzTchjTQb55pKymUe0qVlAy3/5kczV1PQd0IiI=; b=eQX457cLZ4dfiFTJN1i5EHAVEDA4Hj6yuFVUdFrGZ1TB6oAZToJpPcP1ax5zFqurE3 zogOS1LzAhZ99alIiAK8vdOwc4HRv15ma96uYQM3XCbjDJJVMTV9WTjUKAE2dg8a5srp fFtPYReU2bMdEuRveaC0PP0WgH9QWrJSe3MosntvAjt4hxyV8aHmkbE8bTsz3n7wN4/l /yuDs2K1NxoFZ9tjCAEr5S0h7cxwngoYF/QfoedOIuvFqciJU5NF2CbQHGrRwFuTFPaR yUJpxA1Yik/xGbi9v3QO/R+fjqVR6k/uWCRELQJ9xaXu5vire63jBoW4+hhHgk2NQ30v FL7Q== X-Gm-Message-State: ABuFfoguKaXR1ozJuGVs+erqOy8LYJUrTW7w9wtNJ6eAXAQTWR3BqU2J KLxGXBsZX80OFbmradWVGgedBsjcbAE= X-Google-Smtp-Source: ACcGV61NGyfJwqiBXOoi5qPSBOIhpr+icEyr91DnXLwHUQrnEYb5UwtEso+2jRVbgl7B72rw61teyA== X-Received: by 2002:a6b:2c08:: with SMTP id s8-v6mr20764729ios.217.1539120815513; Tue, 09 Oct 2018 14:33:35 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id k15-v6sm2392655itk.8.2018.10.09.14.33.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 14:33:34 -0700 (PDT) Subject: Re: bug#12964: [PATCH] printenv: -n option added -- show names of variables. To: Van de Bugger <van.de.bugger@HIDDEN>, 12964 <at> debbugs.gnu.org References: <1353624141.3382.3.camel@HIDDEN> From: Assaf Gordon <assafgordon@HIDDEN> Message-ID: <f6e24283-b604-fe93-92af-62817607c9ef@HIDDEN> Date: Tue, 9 Oct 2018 15:33:32 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1353624141.3382.3.camel@HIDDEN> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 12964 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) (Triaging old bugs) Hello, On 22/11/12 03:42 PM, Van de Bugger wrote: > Subject: [PATCH] printenv: -n option added -- show names of variables. > > * src/printenv.c: -n option added -- show names of variables. > --- > src/printenv.c | 17 +++++++++++++---- > 1 file changed, 13 insertions(+), 4 deletions(-) Thank you for the patch. It seem it have slipped between the cracks long ago - sorry about that. So summarize: With your patch, using "printenv -n VARNAME" adds the variable name to the output. e.g.: $ printenv HOME /home/gordon $ printenv -n HOME HOME=/home/gordon From a cursory look this seems like a non-standard extension that is not available in any other 'printenv' implementations. Do you have any specific use-cases for this functionality (that can't be easily done with existing methods) ? I'm inclined to close it as "wontfix" - but will wait few days in case others want to chime in with other opinions. regards, - assaf
bug-coreutils@HIDDEN
:bug#12964
; Package coreutils
.
Full text available.Received: (at submit) by debbugs.gnu.org; 23 Nov 2012 00:30:36 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 22 19:30:36 2012 Received: from localhost ([127.0.0.1]:33673 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1TbhAC-0001Gr-5T for submit <at> debbugs.gnu.org; Thu, 22 Nov 2012 19:30:36 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40755) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from <van.de.bugger@HIDDEN>) id 1TbfUu-0007Mj-Lq for submit <at> debbugs.gnu.org; Thu, 22 Nov 2012 17:43:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <van.de.bugger@HIDDEN>) id 1TbfTZ-00036F-51 for submit <at> debbugs.gnu.org; Thu, 22 Nov 2012 17:42:29 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:37144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <van.de.bugger@HIDDEN>) id 1TbfTZ-00036B-1O for submit <at> debbugs.gnu.org; Thu, 22 Nov 2012 17:42:29 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <van.de.bugger@HIDDEN>) id 1TbfTY-0003Mn-2x for bug-coreutils@HIDDEN; Thu, 22 Nov 2012 17:42:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <van.de.bugger@HIDDEN>) id 1TbfTX-00035x-03 for bug-coreutils@HIDDEN; Thu, 22 Nov 2012 17:42:28 -0500 Received: from mail-la0-f41.google.com ([209.85.215.41]:39404) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <van.de.bugger@HIDDEN>) id 1TbfTW-00035s-OP for bug-coreutils@HIDDEN; Thu, 22 Nov 2012 17:42:26 -0500 Received: by mail-la0-f41.google.com with SMTP id m15so5368469lah.0 for <bug-coreutils@HIDDEN>; Thu, 22 Nov 2012 14:42:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:date:content-type:x-mailer:mime-version :content-transfer-encoding; bh=ZCev6va3Nh+BGd0JXqINaQyPaJXdc7IMWA568PgZ2jM=; b=cHZMg6dPfACTMXTc7YyVwOOVfvsCAl3pPs9pJp8CfE/cyMHPWVqa1rrOIYBNRH0jxR BOOtBschTXLf/zlEnIzMHzSuLb5EoAD22MCF45wk7w06KupHglwrB2Rpn+YsLK6uYd+T svmOzMHqLAVplYrm8rBJc70/8mBTK5ujZ52NKli8CSgg4KHpOgdm2N8M19xP9NF/DMZ+ gMAS1SnQBlq/QlOhQEV/e33zdExs8nEqwj/6qR2Rc1abzHe7BDe9dYOvCmI+6IZfX9a7 1ytsRHkjUMpHEv3a3E+zw69ZiwRzogbF9XJKPWVKmYdmqNSP4qI70Avp7ckKDz5JVJVs xRFQ== Received: by 10.112.83.229 with SMTP id t5mr1101078lby.89.1353624145460; Thu, 22 Nov 2012 14:42:25 -0800 (PST) Received: from [95.79.235.150] ([95.79.235.150]) by mx.google.com with ESMTPS id j10sm1917832lbh.17.2012.11.22.14.42.23 (version=SSLv3 cipher=OTHER); Thu, 22 Nov 2012 14:42:24 -0800 (PST) Message-ID: <1353624141.3382.3.camel@HIDDEN> Subject: [PATCH] printenv: -n option added -- show names of variables. From: Van de Bugger <van.de.bugger@HIDDEN> To: bug-coreutils@HIDDEN Date: Fri, 23 Nov 2012 02:42:21 +0400 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.4.4 (3.4.4-2.fc17) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 22 Nov 2012 19:30:34 -0500 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -4.2 (----) From 50aefa315b50b151a2192168fa46e9a311c06147 Mon Sep 17 00:00:00 2001 From: Van de Bugger <van.de.bugger@HIDDEN> Date: Fri, 23 Nov 2012 02:38:48 +0400 Subject: [PATCH] printenv: -n option added -- show names of variables. * src/printenv.c: -n option added -- show names of variables. --- src/printenv.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/printenv.c b/src/printenv.c index 5c01f8d..b4583bd 100644 --- a/src/printenv.c +++ b/src/printenv.c @@ -49,6 +49,7 @@ static struct option const longopts[] = {"null", no_argument, NULL, '0'}, {GETOPT_HELP_OPTION_DECL}, {GETOPT_VERSION_OPTION_DECL}, + {"names", no_argument, NULL, 'n'}, {NULL, 0, NULL, 0} }; @@ -69,6 +70,9 @@ If no VARIABLE is specified, print name and value pairs for them all.\n\ fputs (_("\ -0, --null end each output line with 0 byte rather than newline\n \ "), stdout); + fputs (_("\ + -n, --names print also names of the specified environment VARIABLE(s)\n\ +"), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); printf (USAGE_BUILTIN_WARNING, PROGRAM_NAME); @@ -81,11 +85,12 @@ int main (int argc, char **argv) { char **env; - char *ep, *ap; + char *ep, *ap, *bp; int i; bool ok; int optc; bool opt_nul_terminate_output = false; + bool opt_show_names = false; initialize_main (&argc, &argv); set_program_name (argv[0]); @@ -96,13 +101,16 @@ main (int argc, char **argv) initialize_exit_failure (PRINTENV_FAILURE); atexit (close_stdout); - while ((optc = getopt_long (argc, argv, "+iu:0", longopts, NULL)) != -1) + while ((optc = getopt_long (argc, argv, "+iu:0n", longopts, NULL)) != -1) { switch (optc) { case '0': opt_nul_terminate_output = true; break; + case 'n': + opt_show_names = true; + break; case_GETOPT_HELP_CHAR; case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); default: @@ -130,13 +138,14 @@ main (int argc, char **argv) for (env = environ; *env; ++env) { - ep = *env; + bp = ep = *env; ap = argv[i]; while (*ep != '\0' && *ap != '\0' && *ep++ == *ap++) { if (*ep == '=' && *ap == '\0') { - printf ("%s%c", ep + 1, + printf ("%s%c", + opt_show_names ? bp : ep + 1, opt_nul_terminate_output ? '\0' : '\n'); matched = true; break; -- 1.7.11.7
Van de Bugger <van.de.bugger@HIDDEN>
:bug-coreutils@HIDDEN
.
Full text available.bug-coreutils@HIDDEN
:bug#12964
; Package coreutils
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.