From unknown Tue Aug 19 21:03:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8090: strerror(1) and strsignal(1)? Resent-From: Bruce Korb Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 20 Feb 2011 22:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 8090 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 8090@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.12982418383149 (code B ref -1); Sun, 20 Feb 2011 22:44:02 +0000 Received: (at submit) by debbugs.gnu.org; 20 Feb 2011 22:43:58 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PrI0T-0000ok-Qr for submit@debbugs.gnu.org; Sun, 20 Feb 2011 17:43:58 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PrI0S-0000oa-Jn for submit@debbugs.gnu.org; Sun, 20 Feb 2011 17:43:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PrI0M-0002ZX-Ed for submit@debbugs.gnu.org; Sun, 20 Feb 2011 17:43:51 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:59156) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PrI0M-0002ZR-Bq for submit@debbugs.gnu.org; Sun, 20 Feb 2011 17:43:50 -0500 Received: from [140.186.70.92] (port=38885 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PrI0L-0002t6-7v for bug-coreutils@gnu.org; Sun, 20 Feb 2011 17:43:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PrI0K-0002Yj-91 for bug-coreutils@gnu.org; Sun, 20 Feb 2011 17:43:49 -0500 Received: from mail-yx0-f169.google.com ([209.85.213.169]:58933) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PrI0K-0002YT-6N for bug-coreutils@gnu.org; Sun, 20 Feb 2011 17:43:48 -0500 Received: by yxt33 with SMTP id 33so449560yxt.0 for ; Sun, 20 Feb 2011 14:43:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:content-type:content-transfer-encoding; bh=qVppH8zPx+p6un0syFm4+cq/dcNrnHCTKJP9TJEwD9s=; b=C3EGP2iCUiddiS/pBiPdv1O0gDhCDNAJfMCxcbeS7+xXiWwBiJqLdTPnoWjrvjxJRf +WizvBN1yTKMCZkB8mV5r9R5bMPIgvfT68E/7QkF8phbunHc+M24wmFgoQ8okL6Ommy4 0OjELjBnCiVLXVbW7+3hhF2myrniprKY6cIGU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=Ldq87x7gLrcUPtmNVVPoTgxeTo/iSd9O5nUl5fHeCoXzOJjmpRMHNz0O8/gv8rhIvq NOG8W666vS+zdz/lxmJ6ubCzpj901UnOghHIBKDhnm3QGJOhOsIUxhqaciZa4E2ux1bj /PwHrC3+cPvik3PuyOkbHNsuh7wNmuyNJ3Tyw= Received: by 10.151.112.6 with SMTP id p6mr873671ybm.245.1298241826855; Sun, 20 Feb 2011 14:43:46 -0800 (PST) Received: from [10.10.1.101] (adsl-75-2-134-104.dsl.pltn13.sbcglobal.net [75.2.134.104]) by mx.google.com with ESMTPS id q20sm1199140ybk.17.2011.02.20.14.43.45 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 20 Feb 2011 14:43:46 -0800 (PST) Message-ID: <4D61991F.7040502@gmail.com> Date: Sun, 20 Feb 2011 14:43:43 -0800 From: Bruce Korb User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101125 SUSE/3.0.11 Thunderbird/3.0.11 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 199.232.76.165 X-Spam-Score: -5.9 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) Hi, I had to go grubbing through headers to translate "11" into something comprehensible one too many times. If this is acceptable, I'll double my time investment and whip up some .texi verbiage. I believe my paperwork is in order, but I'm not convinced that this qualifies as "significant" :-D. Cheers - Bruce #ifndef code_to_text #define code_to_text strerror #endif #define _str(_s) #_s #define STRINGIFY(_s) _str(_s) static char const usage_txt[] = "Usage: " STRINGIFY(code_to_text) " [--help | [...]]\n"; static char const xlate_func[] = STRINGIFY(code_to_text); static char const * const code_type = xlate_func + 3; #include #include #include #include #include static void usage (char const * msg_fmt, ...) { int exit_code = EXIT_SUCCESS; FILE * fp = stdout; if (msg_fmt != NULL) { va_list ap; fp = stderr; exit_code = EXIT_FAILURE; va_start (ap, msg_fmt); vfprintf (fp, msg_fmt, ap); va_end (ap); } fwrite (usage_txt, sizeof (usage_txt) - 1, 1, fp); exit (exit_code); } int main (int argc, char ** argv) { char const * arg1 = argv[1]; switch (argc) { case 1: usage ("no %s codes were supplied\n", code_type); case 2: if (*arg1 != '-') break; if (strcmp (arg1 + 1, "-help") == 0) usage (NULL); if ((arg1[1] == 'h') && (arg1[2] == '\0')) usage (NULL); break; } while (--argc > 0) { static char const bad_num[] = "'%s' is not a valid number - error %d (%s)\n"; char const * arg = *(++argv); unsigned long val; char * p; errno = 0; val = strtoul (arg, &p, 0); if (errno != 0) usage (bad_num, arg, errno, strerror (errno)); if (*p != '\0') usage (bad_num, arg, EINVAL, strerror (EINVAL)); printf ("%s %3d %s\n", code_type, val, code_to_text (val)); } return EXIT_SUCCESS; } /* * Local Variables: * mode: C * c-file-style: "gnu" * indent-tabs-mode: nil * End: * end of strerror.c */ From unknown Tue Aug 19 21:03:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8090: strerror(1) and strsignal(1)? Resent-From: Jim Meyering Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 20 Feb 2011 23:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8090 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bruce Korb Cc: 8090@debbugs.gnu.org Received: via spool by 8090-submit@debbugs.gnu.org id=B8090.12982440336154 (code B ref 8090); Sun, 20 Feb 2011 23:21:02 +0000 Received: (at 8090) by debbugs.gnu.org; 20 Feb 2011 23:20:33 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PrIZs-0001bD-8t for submit@debbugs.gnu.org; Sun, 20 Feb 2011 18:20:32 -0500 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PrIZq-0001b1-JZ for 8090@debbugs.gnu.org; Sun, 20 Feb 2011 18:20:31 -0500 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id EA275600C0; Mon, 21 Feb 2011 00:20:24 +0100 (CET) From: Jim Meyering In-Reply-To: <4D61991F.7040502@gmail.com> (Bruce Korb's message of "Sun, 20 Feb 2011 14:43:43 -0800") References: <4D61991F.7040502@gmail.com> Date: Mon, 21 Feb 2011 00:20:24 +0100 Message-ID: <87y65afg3r.fsf@rho.meyering.net> Lines: 58 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -5.8 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.8 (-----) Bruce Korb wrote: > I had to go grubbing through headers to translate "11" into something > comprehensible one too many times. If this is acceptable, I'll double > my time investment and whip up some .texi verbiage. > > I believe my paperwork is in order, but I'm not convinced that this > qualifies as "significant" :-D. Hi Bruce, [your subject mentions strsignal -- you know you can get a list via "env kill --table", assuming you have kill from coreutils? ] I've had that itch many times. Here are some handy bash/perl functions I wrote: $ errno-find 11 EAGAIN $ errno-int-to-msg 11 Resource temporarily unavailable $ errno-sym-to-int EAGAIN 11 # Print a table of names/values/messages: errno-table() { perl -MErrno -e 'my %e= map { Errno->$_()=>$_ } keys %!;' \ -e 'print grep !/unknown error/i,' \ -e 'map sprintf("%4d %-12s %s".$/,$_,$e{$_},$!=$_), 0..256' } # map errno integer to message, e.g., 2 to No such file or directory errno-int-to-msg() { local fail=0 case $# in 1) case $1 in [0-9]*) ;; *) fail=1;; esac;; *) fail=1;; esac test $fail = 1 && { echo "Usage: $FUNCNAME ERRNO_INT" 1>&2; return 1; } perl -le '$!='"$1"'; print $!' } # map errno symbolic name to integer, e.g., ENOSYS to 28 errno-sym-to-int() { local fail=0 case $# in 1) case $1 in [0-9]*) fail=1;; esac;; *) fail=1;; esac test $fail = 1 && { echo "Usage: $FUNCNAME ERRNO_SYM" 1>&2; return 1; } perl -le "use Errno '$1'; print $1" } errno-find() { case $# in 1) ;; *) echo "Usage: $FUNCNAME ERRNO_VALUE" 1>&2; return 1;; esac perl -MErrno -le 'my %e=map { Errno->$_()=>$_ } keys %!; print $e{'"$1"'}' } From unknown Tue Aug 19 21:03:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8090: strerror(1) and strsignal(1)? Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 20 Feb 2011 23:38:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8090 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bruce Korb Cc: 8090@debbugs.gnu.org Received: via spool by 8090-submit@debbugs.gnu.org id=B8090.12982450807677 (code B ref 8090); Sun, 20 Feb 2011 23:38:03 +0000 Received: (at 8090) by debbugs.gnu.org; 20 Feb 2011 23:38:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PrIql-0001zm-N9 for submit@debbugs.gnu.org; Sun, 20 Feb 2011 18:38:00 -0500 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1PrIqh-0001zW-Uh for 8090@debbugs.gnu.org; Sun, 20 Feb 2011 18:37:56 -0500 Received: (qmail 21760 invoked from network); 20 Feb 2011 23:37:49 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 20 Feb 2011 23:37:49 -0000 Message-ID: <4D61A4F0.4060901@draigBrady.com> Date: Sun, 20 Feb 2011 23:34:08 +0000 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 References: <4D61991F.7040502@gmail.com> In-Reply-To: <4D61991F.7040502@gmail.com> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.7 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) You might consider setting the locale etc. to get localised strings. However this was considered before and discounted as overkill: http://lists.gnu.org/archive/html/bug-coreutils/2010-01/msg00060.html Personally I use this in my ~/.bashrc strerror() { python -c "\ import os,locale as l; l.setlocale(l.LC_ALL, ''); print os.strerror($1)"; } cheers, Pádraig. From unknown Tue Aug 19 21:03:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8090: strerror(1) and strsignal(1)? Resent-From: Bruce Korb Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 21 Feb 2011 00:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8090 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Jim Meyering Cc: 8090@debbugs.gnu.org Received: via spool by 8090-submit@debbugs.gnu.org id=B8090.129824769511198 (code B ref 8090); Mon, 21 Feb 2011 00:22:02 +0000 Received: (at 8090) by debbugs.gnu.org; 21 Feb 2011 00:21:35 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PrJWw-0002uY-A2 for submit@debbugs.gnu.org; Sun, 20 Feb 2011 19:21:34 -0500 Received: from mail-iw0-f172.google.com ([209.85.214.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PrJWu-0002uJ-2o for 8090@debbugs.gnu.org; Sun, 20 Feb 2011 19:21:32 -0500 Received: by iwl42 with SMTP id 42so2308120iwl.3 for <8090@debbugs.gnu.org>; Sun, 20 Feb 2011 16:21:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=OgdQBCiomg6wqcSs3CvZdX7p3BYVGAipIjlKJjVAmcw=; b=HVrnoCaRB7imQcMjboswZadAQ0UyyPa+nlcncxlpfa5gpZp0vGlCmy5quEpeTcm1fw MQUyAXYsuqslaD9tXZA5Fhp2FRKAf03pNxtWs1wOMNJpZxNRwqUFLqMyzYe0SjIAZDMu W5V2qLONoWr5+zeTenfjEy7IqU1v3KlEPN0DE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=TjRD13gQHIeuVs+IJgb+bznTpxDjyo+eH8iLZ7aMGiID9VMhSRyEryVnnnEiJQlKgB 1M9VwJm9NrzgvC16ul+cK/XNGZRlRhySLPggZ88OJaJU2//Oz1jBwtxZIWQ59F2vZVYY 8f++F1JYpxGKAMZ74r21uLMqm31iONrjvYY8c= Received: by 10.231.37.138 with SMTP id x10mr665237ibd.192.1298247686383; Sun, 20 Feb 2011 16:21:26 -0800 (PST) Received: from [10.10.1.101] (adsl-75-2-134-104.dsl.pltn13.sbcglobal.net [75.2.134.104]) by mx.google.com with ESMTPS id d21sm4568909ibg.3.2011.02.20.16.21.25 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 20 Feb 2011 16:21:26 -0800 (PST) Message-ID: <4D61B003.9070509@gmail.com> Date: Sun, 20 Feb 2011 16:21:23 -0800 From: Bruce Korb User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101125 SUSE/3.0.11 Thunderbird/3.0.11 MIME-Version: 1.0 References: <4D61991F.7040502@gmail.com> <87y65afg3r.fsf@rho.meyering.net> In-Reply-To: <87y65afg3r.fsf@rho.meyering.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -4.8 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.4 (----) Hi Jim, On 02/20/11 15:20, Jim Meyering wrote: > Bruce Korb wrote: > Hi Bruce, > > [your subject mentions strsignal -- you know you can get a list > via "env kill --table", assuming you have kill from coreutils? ] > > I've had that itch many times. > Here are some handy bash/perl functions I wrote: Yep. I know one can get to it via perl. OTOH, _you've_ had that itch many times, Padraig's had that itch many times, and I'd take a wild guess that there have been a few others, too. So it still remains for the itchy folks to drag something around to new places whenever they go to a new environment. Were it in "coreutils", it would likely be more easily found. It also fits well with my pet theory that library function names ought to have same-named commands lying about. Thus, if you can remember strerror(3p), then by golly there's a strerror(1), too, with obvious options (none, in this case) and operands. (Aside, that program handles strsignal with "-Dcode_to_text=strsignal" on the command line.) > $ errno-find 11 > EAGAIN > $ errno-int-to-msg 11 > Resource temporarily unavailable > $ errno-sym-to-int EAGAIN > 11 Nice. I've copied them into my shell functions directory. I still think strerror(3p) ought to imply a strerror(1) command, but I leave it to you to decide. It's just my preference. Cheers - Bruce From unknown Tue Aug 19 21:03:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8090: strerror(1) and strsignal(1)? References: <4D61991F.7040502@gmail.com> Resent-From: "Alan Curry" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 21 Feb 2011 00:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8090 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: bruce.korb@gmail.com (Bruce Korb) Cc: Jim Meyering , 8090@debbugs.gnu.org Received: via spool by 8090-submit@debbugs.gnu.org id=B8090.129824957213695 (code B ref 8090); Mon, 21 Feb 2011 00:53:01 +0000 Received: (at 8090) by debbugs.gnu.org; 21 Feb 2011 00:52:52 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PrK1D-0003Yq-N2 for submit@debbugs.gnu.org; Sun, 20 Feb 2011 19:52:51 -0500 Received: from c-67-162-90-113.hsd1.in.comcast.net ([67.162.90.113] helo=kosh.dhis.org) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1PrK1B-0003Yd-7U for 8090@debbugs.gnu.org; Sun, 20 Feb 2011 19:52:49 -0500 Received: (qmail 14682 invoked by uid 1000); 21 Feb 2011 00:52:42 -0000 Message-ID: <20110221005242.14681.qmail@kosh.dhis.org> From: "Alan Curry" Date: Sun, 20 Feb 2011 19:52:42 -0500 (GMT+5) In-Reply-To: <4D61B003.9070509@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Score: -0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.6 (/) Bruce Korb writes: > > Hi Jim, > > On 02/20/11 15:20, Jim Meyering wrote: > > Bruce Korb wrote: > > Hi Bruce, > > > > [your subject mentions strsignal -- you know you can get a list > > via "env kill --table", assuming you have kill from coreutils? ] What's the installation rate of coreutils-kill vs. procps kill? Debian chooses procps kill (except on Hurd and maybe freebsd-kernel) > > > > I've had that itch many times. > > Here are some handy bash/perl functions I wrote: > > Yep. I know one can get to it via perl. OTOH, _you've_ had that > itch many times, Padraig's had that itch many times, and I'd take > a wild guess that there have been a few others, too. So it still You guys don't perl-golf well. perl -E'say$!=11' or for older perls perl -le'print$!=11' > remains for the itchy folks to drag something around to new places > whenever they go to a new environment. Were it in "coreutils", > it would likely be more easily found. It also fits well with my > pet theory that library function names ought to have same-named > commands lying about. Thus, if you can remember strerror(3p), > then by golly there's a strerror(1), too, with obvious options > (none, in this case) and operands. The important thing is that when you need to use this utility, you report a bug on the program that printed a number instead of calling strerror(3) itself. Error numbers are not a user interface, regardless of Microsoft's attempt to train people otherwise. > Nice. I've copied them into my shell functions directory. > I still think strerror(3p) ought to imply a strerror(1) command, > but I leave it to you to decide. It's just my preference. Just as write(2) implies write(1), and time(2) implies time(1). Or something like that. -- Alan Curry From unknown Tue Aug 19 21:03:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8090: strerror(1) and strsignal(1)? Resent-From: Bruce Korb Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 21 Feb 2011 15:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8090 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Alan Curry Cc: Jim Meyering , 8090@debbugs.gnu.org Received: via spool by 8090-submit@debbugs.gnu.org id=B8090.129830275126020 (code B ref 8090); Mon, 21 Feb 2011 15:40:02 +0000 Received: (at 8090) by debbugs.gnu.org; 21 Feb 2011 15:39:11 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PrXqx-0006lc-65 for submit@debbugs.gnu.org; Mon, 21 Feb 2011 10:39:11 -0500 Received: from mail-pz0-f44.google.com ([209.85.210.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PrXqu-0006lP-Su for 8090@debbugs.gnu.org; Mon, 21 Feb 2011 10:39:09 -0500 Received: by pzk30 with SMTP id 30so294226pzk.3 for <8090@debbugs.gnu.org>; Mon, 21 Feb 2011 07:39:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=j2JV0WKUMJ+cWhI0Uzfr6YkW4lakVtZZsb5PJjNlyEQ=; b=fXz03R1MjTtrpZdoG0Zg/nDahIiOJ3RgjCxocDoWs1j99/78eWkS4/BVv5jwCzEegd mPv7yyRkQ0AtHF//CQq8fl5WLDoGqdtDI/Fnpv/8ZUWIO+tXUhQwCXm1I4xrRDn77fnF bJgjstupAXGIoGA1ji+/Lcaoh0REzkhMwHjSQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=j1EXkULfJ46lVEMu4xOUANDjtD8gJAl5+gNonoDfGjt70cUhOM9KhUfePTteqFSbyK CBjG33fxMQ36fEB5coXohYIrUjpEsYoSEeF5UWqUJbs/SAAvDsz9tXbkeSKgF/XFI9yl GZoGe910cMFid0UhaNaHl+yrDB+7gexcPYSKk= Received: by 10.142.122.20 with SMTP id u20mr44427wfc.176.1298302742773; Mon, 21 Feb 2011 07:39:02 -0800 (PST) Received: from [10.10.1.101] (adsl-75-2-134-104.dsl.pltn13.sbcglobal.net [75.2.134.104]) by mx.google.com with ESMTPS id n4sm7259915wfl.2.2011.02.21.07.39.01 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 21 Feb 2011 07:39:02 -0800 (PST) Message-ID: <4D628713.5090608@gmail.com> Date: Mon, 21 Feb 2011 07:38:59 -0800 From: Bruce Korb User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101125 SUSE/3.0.11 Thunderbird/3.0.11 MIME-Version: 1.0 References: <20110221005242.14681.qmail@kosh.dhis.org> In-Reply-To: <20110221005242.14681.qmail@kosh.dhis.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -4.2 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.1 (----) Hi Jim, Alan, et al., On 02/20/11 16:52, Alan Curry wrote: >> remains for the itchy folks to drag something around to new places >> whenever they go to a new environment...... > > The important thing is that when you need to use this utility, you report a > bug on the program that printed a number instead of calling strerror(3) That might be a little less convenient than grepping through `find /usr/include -name '*errno*.h'` results. >> Nice. I've copied them into my shell functions directory. >> I still think strerror(3p) ought to imply a strerror(1) command, >> but I leave it to you to decide. It's just my preference. > > Just as write(2) implies write(1), and time(2) implies time(1). Or something > like that. "write" isn't right because it serves a different function. "time" is also different. There's no getting around the fact that being proficient requires remembering a lot of stuff. My point is that the less you have to remember, the easier it is. So you need to convert an error code into a humanly comprehensible string. When writing "C", you call strerror(). In user space, what command requires less to remember? Either "errno" because there's a header by that name and there's a global variable that often holds the value by that name, but there is also the library conversion function strerror and there is strsignal(3). If you include strsignal(1), then strerror(1) is consistent. Just do not pick "describe --fserror 11". ;) Anyway, the choice between errno(1) and strerror(1) is pretty marginal. As for whether it ought to be a coreutil or a devutil, it's no big deal either way to me. I just think it probably ought to be provided one way or another so we don't have so many re-inventions of code-to-string translation programs. From unknown Tue Aug 19 21:03:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8090: strerror(1) and strsignal(1)? Resent-From: Jim Meyering Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 21 Feb 2011 16:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8090 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: "Alan Curry" Cc: Bruce Korb , 8090@debbugs.gnu.org Received: via spool by 8090-submit@debbugs.gnu.org id=B8090.129830502329237 (code B ref 8090); Mon, 21 Feb 2011 16:18:02 +0000 Received: (at 8090) by debbugs.gnu.org; 21 Feb 2011 16:17:03 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PrYRb-0007b3-EO for submit@debbugs.gnu.org; Mon, 21 Feb 2011 11:17:03 -0500 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PrYRU-0007am-Ei for 8090@debbugs.gnu.org; Mon, 21 Feb 2011 11:16:57 -0500 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id AF5DE600CD; Mon, 21 Feb 2011 17:16:49 +0100 (CET) From: Jim Meyering In-Reply-To: <20110221005242.14681.qmail@kosh.dhis.org> (Alan Curry's message of "Sun, 20 Feb 2011 19:52:42 -0500 (GMT+5)") References: <4D61991F.7040502@gmail.com> <20110221005242.14681.qmail@kosh.dhis.org> Date: Mon, 21 Feb 2011 17:16:49 +0100 Message-ID: <87mxlpe51q.fsf@rho.meyering.net> Lines: 49 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -5.8 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.8 (-----) Alan Curry wrote: > Bruce Korb writes: >> >> Hi Jim, >> >> On 02/20/11 15:20, Jim Meyering wrote: >> > Bruce Korb wrote: >> > Hi Bruce, >> > >> > [your subject mentions strsignal -- you know you can get a list >> > via "env kill --table", assuming you have kill from coreutils? ] > > What's the installation rate of coreutils-kill vs. procps kill? Debian > chooses procps kill (except on Hurd and maybe freebsd-kernel) Actually, you can also use shell-builtin functions, so whether coreutils' kill program is installed matters less: $ bash -c 'builtin kill -l 3' SIGQUIT $ zsh -c 'builtin kill -l 3' QUIT >> > I've had that itch many times. >> > Here are some handy bash/perl functions I wrote: >> >> Yep. I know one can get to it via perl. OTOH, _you've_ had that >> itch many times, Padraig's had that itch many times, and I'd take >> a wild guess that there have been a few others, too. So it still > > You guys don't perl-golf well. > > perl -E'say$!=11' > > or for older perls > > perl -le'print$!=11' Those are cute, and no doubt minimal, but for something like this, I would favor readability (yeah, the quotes make it ugly) over minimality: errno-int-to-msg() { local fail=0 case $# in 1) case $1 in [0-9]*) ;; *) fail=1;; esac;; *) fail=1;; esac test $fail = 1 && { echo "Usage: $FUNCNAME ERRNO_INT" 1>&2; return 1; } perl -le '$!='"$1"'; print $!' } From unknown Tue Aug 19 21:03:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8090: strerror(1) and strsignal(1)? Resent-From: Assaf Gordon Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 28 Oct 2018 08:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8090 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 8090@debbugs.gnu.org Received: via spool by 8090-submit@debbugs.gnu.org id=B8090.154071495320864 (code B ref 8090); Sun, 28 Oct 2018 08:23:02 +0000 Received: (at 8090) by debbugs.gnu.org; 28 Oct 2018 08:22:33 +0000 Received: from localhost ([127.0.0.1]:46636 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGgLA-0005QM-1R for submit@debbugs.gnu.org; Sun, 28 Oct 2018 04:22:32 -0400 Received: from mail-pg1-f171.google.com ([209.85.215.171]:43510) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGgL6-0005Pu-TW; Sun, 28 Oct 2018 04:22:29 -0400 Received: by mail-pg1-f171.google.com with SMTP id n10-v6so2421652pgv.10; Sun, 28 Oct 2018 01:22:28 -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=gokhXDZGqYvNtQGu8R4n7Eg6A5eXYOdRW3cVB4xIygY=; b=YYz/TyfOgNHxe5Zbh9G664tqr4BhUcYuCZVqIBEFX2RYFtIZTm4ItooPhdQS295xd2 kJX/s7rlU/vzBiQ9ySXK1q1yKr10BZN/xlf16wJyHiIa/QypEqbAOEXv8tScQSsxr2aH dgLqc0GU34n758KtGFrVVJ91ViK27eG7DWCNGCyTzQqQiyOZCZ0gx6Xp1PULgED7+t3s rSkyo+PQz/zeVfXHTFQ+r/oH3EHe9TS8H7WYXC3X1e8nJcYxaQ1VWwCxGXWJXbJEYnlB ZK7bqMUOheIjtAhQzAKU+8k0UqTWasAzuuNnyoE8ZBDUzFVCeLN4uG+pg7HDOXAwLsHa Me7g== 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=gokhXDZGqYvNtQGu8R4n7Eg6A5eXYOdRW3cVB4xIygY=; b=NaPwCWCd+8mdgxlrPHzDag7Osn76hog2a9qq+8Rg8XkM4wUeMaVyuoNkP3rzNH3chd 5wx7fouqqdrdLgxA4xRdegzRO38IqbUN1YND+AcqST6zeQpPghv/XpXCYJbcEI9uFnc4 RxvihmCdB0bamIqttBlKOqFFECT3guGkF7pdf92v/+59LtQDfHFWWq88jIEEY2aXYGXb CkutwHtx0zHI8uKy+abLtJKofdut9n2+P1/w1AXqLgJ/RnX7zbCb1bJKncJ7isRXq1CM MN7nrdrDXDcgcU6UM0ukpGQZxm4i6mF2HHf/6vp7g8qAUyizeTIq+aX9JuunooduXZ6N s/9g== X-Gm-Message-State: AGRZ1gK3P6/FNRAnsuaAjFoDqyGfhXBlFxKIsfRjW6N6haNebiHpmZuk 7K/e/UwOKaRjZZlu4evLmBq3Cgy7f1E= X-Google-Smtp-Source: AJdET5f+i2j2P7UWoZqGzZ6yjdXyt+u/WQcBplTENbKayBUBBs8cvikOLD1Uc4h1FyFkkLt/BeqPVA== X-Received: by 2002:a62:5441:: with SMTP id i62-v6mr10433326pfb.155.1540714942110; Sun, 28 Oct 2018 01:22:22 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id p14-v6sm18109979pgn.45.2018.10.28.01.22.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Oct 2018 01:22:20 -0700 (PDT) References: <4D61991F.7040502@gmail.com> <4D61A4F0.4060901@draigBrady.com> From: Assaf Gordon Message-ID: <2fac4572-cb5d-2916-9a3b-d7f4f5056f92@gmail.com> Date: Sun, 28 Oct 2018 02:22:19 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <4D61A4F0.4060901@draigBrady.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) retitle 8090 new programs: strerror(1) and strsignal(1)? severity 8090 wishlist tags 8090 wontfix close 8090 stop (triaging old bugs) On 2011-02-20 4:34 p.m., Pádraig Brady wrote: > However this was considered before and discounted as overkill: > http://lists.gnu.org/archive/html/bug-coreutils/2010-01/msg00060.html Given the above (and similar replies in the thread), and no more comments in 7 years, I'm closing this bug. Discussion can continue by replying to this thread. -assaf