DASH Shell discussions
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Isaac Jurado <diptongo@gmail.com>
Cc: Paul Gilmartin <PaulGBoulder@aim.com>, dash <dash@vger.kernel.org>
Subject: Re: [PATCH] [BUILTIN] Allow SIG* signal names.
Date: Mon, 02 Jul 2012 13:07:22 -0600	[thread overview]
Message-ID: <4FF1F16A.7010103@redhat.com> (raw)
In-Reply-To: <CALqPu34=a629YmEiqk008a7aMF26ObEz=MCGA3vZBKTkr25hQA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2285 bytes --]

On 07/02/2012 12:53 PM, Isaac Jurado wrote:
> On Mon, Jul 2, 2012 at 4:22 PM, Eric Blake <eblake@redhat.com> wrote:
>> On 07/02/2012 08:11 AM, Paul Gilmartin wrote:
>>> On Jul 2, 2012, at 07:51, Eric Blake wrote:
>>>>
>>>> ... non-required bloat ...
>>>>
>>> The key phrase.  And one value of a shell lacking such
>>> extensions is that it provides an excellent test bed for
>>> code intended to be portable within the POSIX spec.
>>
>> That argues that we should drop our strcasecmp() for the much simpler
>> strcmp(), in order to remove the bloat we already have.
> 
> I guess my patch has no chance to be accepted.

I'm not the maintainer, so my decision is not indicative of what the
dash maintainer will choose.  But my personal preference would be that
we change this area of code, either to:

1. be lighter-weight (drop strcasecmp, which is locale-dependent, and
replace it with strcmp)

2. be more user-friendly (accept optional case-insensitive SIG prefix)

Both approaches are permitted by POSIX, so it boils down to a judgment
call of whether providing useful extensions or providing a minimally
compliant shell is more important.

>  But I'm still curious
> about what kind of "bloat" you are referring to.  I'm assuming it's not
> code bloat in terms of lines of code.

Even one byte larger in the final executable size has been deemed bloat
on this list in the past.  Dash prides itself on being minimalistic, but
you happened to point out an area of code that is not currently minimal.

> 
> If the signal name to number conversion seems too expensive (linear
> search multiplied by the string lengths, wether it is case sensitive or
> not), there is a much more elegant solution: perfect hashing.

Indeed, that would provide faster lookup, but it would also cost more
executable size (the storage requirements for a perfect hash table are
larger than the size of a loop comparison); I don't know whether the
preference is for speed, for minimal size, or for a hybrid of the two
(where larger size is okay only if it proves to have more speed).  So
hopefully the dash maintainer will chime in on the topic.

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org




[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]

  parent reply	other threads:[~2012-07-02 19:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-01 10:12 [PATCH] [BUILTIN] Allow SIG* signal names Isaac Jurado
2012-07-02 13:51 ` Eric Blake
2012-07-02 14:11   ` Paul Gilmartin
2012-07-02 14:22     ` Eric Blake
2012-07-02 18:53       ` Isaac Jurado
2012-07-02 18:57         ` Isaac Jurado
2012-07-02 19:07         ` Eric Blake [this message]
2012-07-02 19:21           ` Isaac Jurado
2012-07-03 20:13       ` Jilles Tjoelker
2012-07-05  7:43         ` Herbert Xu
2012-07-05 21:01           ` Isaac Jurado

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FF1F16A.7010103@redhat.com \
    --to=eblake@redhat.com \
    --cc=PaulGBoulder@aim.com \
    --cc=dash@vger.kernel.org \
    --cc=diptongo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox