[pacman-dev] [PATCH] remove isatty check before reading from stdin

Dave Reisner d at falconindy.com
Sat Nov 24 13:29:14 EST 2012


On Sat, Nov 24, 2012 at 01:15:17PM -0500, Andrew Gregory wrote:
> The old behavior is undocumented and we already require the user
> to explicitly request reading from stdin so we should oblige them
> whether stdin is a tty or not.
> 
> Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
> ---
>  src/pacman/pacman.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
> index e86b5c7..d9de556 100644
> --- a/src/pacman/pacman.c
> +++ b/src/pacman/pacman.c
> @@ -809,7 +809,7 @@ int main(int argc, char *argv[])
>  	}
>  
>  	/* we support reading targets from stdin if a cmdline parameter is '-' */
> -	if(!isatty(fileno(stdin)) && alpm_list_find_str(pm_targets, "-")) {
> +	if(alpm_list_find_str(pm_targets, "-")) {

Just for fun, this would make a package by the name of '-' (which is a
valid name) only accessible via something like:

  pacman -Si - <<<-

Alternatively, I think it'd be a little weird to see pacman just "hang"
if you had a random '-' as an argument and pacman just hung.

Is there anything this patch actually fixes?

>  		size_t current_size = PATH_MAX;
>  		char *vdata, *line = malloc(current_size);
>  
> -- 
> 1.8.0
> 
> 


More information about the pacman-dev mailing list