emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#19520: closed (shuf: extra operand handling with -


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#19520: closed (shuf: extra operand handling with -i)
Date: Tue, 06 Jan 2015 03:43:01 +0000

Your message dated Mon, 05 Jan 2015 19:42:04 -0800
with message-id <address@hidden>
and subject line Re: bug#19520: shuf: extra operand handling with -i
has caused the debbugs.gnu.org bug report #19520,
regarding shuf: extra operand handling with -i
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
19520: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19520
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: shuf: extra operand handling with -i Date: Tue, 06 Jan 2015 12:14:02 +0900 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)
I heard that shuf causes a segmentation fault if an extra argument is
given with the -i option:

  $ shuf -i0-0 1
  zsh: segmentation fault (core dumped)  shuf -i0-0 1

the crash is in quotearg.c, where NULL is passed as an input.

I'm attaching a patch.

>From daa0873ff9197a687a086409f4ce77a7856ab72d Mon Sep 17 00:00:00 2001
From: Daiki Ueno <address@hidden>
Date: Tue, 6 Jan 2015 11:51:59 +0900
Subject: [PATCH] shuf: fix extra operand handling with -i

* src/shuf.c (main): When the input is a range, use argv[optind]
as the first extra operand, instead of argv[optind + 1].
---
 src/shuf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/shuf.c b/src/shuf.c
index 75211bd..d31dc91 100644
--- a/src/shuf.c
+++ b/src/shuf.c
@@ -501,7 +501,7 @@ main (int argc, char **argv)
     }
   if (input_range ? 0 < n_operands : !echo && 1 < n_operands)
     {
-      error (0, 0, _("extra operand %s"), quote (operand[1]));
+      error (0, 0, _("extra operand %s"), quote (operand[input_range ? 0 : 
1]));
       usage (EXIT_FAILURE);
     }
 
-- 
2.1.0

Regards,
--
Daiki Ueno

--- End Message ---
--- Begin Message --- Subject: Re: bug#19520: shuf: extra operand handling with -i Date: Mon, 05 Jan 2015 19:42:04 -0800 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 Thanks for reporting that. I installed the attached patch, which has a test for the bug.

Attachment: 0001-shuf-do-not-mishandle-shuf-i0-0-1.patch
Description: Text Data


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]