zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: rsync --progress stops completion
Date: Sat, 20 Sep 2014 17:48:51 -0700	[thread overview]
Message-ID: <140920174851.ZM5095@torch.brasslantern.com> (raw)
In-Reply-To: <9603.1411126819@thecus.kiddle.eu>

On Sep 19,  1:40pm, Oliver Kiddle wrote:
}
} > _cryptsetup - offers all options when completing after "-", but will
} >  only allow one option to appear on the command line, as if all options
} >  are mutually exclusive.
} 
} I can't reproduce this.

I can't either, now.  It may have had something to do with the set of
options I randomly selected for testing.  Sorry for the false alarm.

} > _bzr - complains to stderr if bzr is not in $path
} > _surfraw - complains to stderr if surfraw is not in $path
} > 
} > The latter two make me think that _call_program should do something
} > with stderr -- probably just throw it away, rather than make every
} > caller add its own redirection.
} 
} Note that a significant number of programs send their --help output to
} stderr. They're easily identified by searching for 2>& if the functions
} need adjusting to avoid breaking them.

Right, but that's an entirely different situation; if the --help output
goes to stder, then 2>&1 has to appear in the 'command' zstyle and in
the arguments passed to _call_program.  I'm talking about "command not
found" sorts of errors, which just garble up ZLE to no good effect.

} _call_program could throw away
} stderr unless something like -e is passed. But should -e imply 2>&1?

No, this can't work.  _call_program runs an "eval" on the value of the
"command" zstyle in preference to its argument list, so it has no way
of knowing whether it's appropriate to insert "2>&1".

On the other hand its silly for every single use of _call_program that
*does not* need 2>&1 to have to use 2>/dev/null.

There are 229 uses of _call_program in the completion tree:
  16 redirect stderr to stdout
 107 redirect stderr to /dev/null
 106 do not redirect stderr at all

I'm guessing that all of those latter 106 *ought to* use 2>/dev/null,
because if they needed 2>&1 they'd be broken already.

If nearly half of all functions are getting this wrong, and 90%+ of
all functions need a certain behavior, that behavior probably should
be the default, don't you think?

} The advantage of an explicit 2>/dev/null is everyone knows what it does
} without checking the manual.

An explicit 2>/dev/null where?  In the completion function use of
_call_program?  Except that anyone looking at function source as an
example for a new function has a 50/50 chance of choosing the wrong
example, as things currently stand.

(One could argue that the whole completion system should be capturing
stderr somewhere and showing it to the user in a controlled way rather
than letting it scramble the display, but that's a larger issue.)


  reply	other threads:[~2014-09-21  0:48 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-16 15:00 Yuri D'Elia
2014-09-16 15:09 ` Vadim A. Misbakh-Soloviov
2014-09-16 17:50   ` Yuri D'Elia
2014-09-17  0:51     ` Bart Schaefer
2014-09-17  8:08       ` Yuri D'Elia
2014-09-17 15:51         ` Bart Schaefer
2014-09-18  9:42           ` Yuri D'Elia
2014-09-18 16:36             ` Bart Schaefer
2014-09-19  2:01               ` Bart Schaefer
2014-09-19  3:22                 ` Mikael Magnusson
2014-09-19 11:40                 ` Oliver Kiddle
2014-09-21  0:48                   ` Bart Schaefer [this message]
2014-09-20 13:25                 ` Yuri D'Elia
2014-09-20 18:20                   ` Bart Schaefer
2014-09-21 16:43                     ` Yuri D'Elia
2014-09-21 17:20                       ` Bart Schaefer
2014-09-21 17:33                         ` Yuri D'Elia
2014-09-21 19:38                           ` Bart Schaefer
2014-09-21 20:27                             ` Yuri D'Elia
2014-09-21 20:37                               ` Yuri D'Elia
2014-09-21 22:07                                 ` Bart Schaefer
2014-09-21 22:29                                   ` Yuri D'Elia
2014-09-22  6:58                                     ` Bart Schaefer
2014-09-21 21:08                               ` Bart Schaefer
2014-09-21 21:35                                 ` Yuri D'Elia
2014-09-21 21:54                                   ` typeset -g (was Re: rsync --progress stops completion) Bart Schaefer
2014-09-21 18:52                         ` rsync --progress stops completion Yuri D'Elia
2014-09-21 18:59                         ` Yuri D'Elia
2014-09-20 13:20               ` Yuri D'Elia
2014-09-23 14:23                 ` Oliver Kiddle
2014-09-23 14:43                   ` Peter Stephenson
2014-09-16 15:25 ` Vadim A. Misbakh-Soloviov
2014-09-16 16:28 ` Bart Schaefer

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=140920174851.ZM5095@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).