Found and fixed. There were several issues. First, most people who type
seq are really running seq on their host. Fish will only use the builtin if
it doesn't find it locally. Use 'seq --version' to see what I mean.
Second, the getopt processing is kinda broken sometimes. I don't know if
this is a macos thing, or what. But, when I turned off the system getopt,
by modifying config.h to undef both the GETOPT options, then recompiled, I
got past the below ugliness.
Then, I was able to make a quick fix. In a nutshell, it farms out the seq
to bc. And, it was set to only go up, not down. So, I hacked negative
steps into it. Actually, I didn't do it based on the sign of the step, and
I probably should have . . hmm . . anyway, this patch works. Maybe I'll
change it to compare the step to zero next time, and do the logic based on
that:
http://github.com/CodeMonk/fish/commit/535858658e81e38f5b5556cb5a64275c32e22322
-Dave
On Fri, Apr 2, 2010 at 1:18 AM, David Frascone <[email protected]> wrote:
> I can get repeatable failed behavior . . but I can't seem to figure out
> where it's evaluating that option . . . it's very strange.
>
> codemon...@daves-mbp ~/W/fish> fish -c 'seq 10 -1 5'
> fish: invalid option -- 1
> codemon...@daves-mbp ~/W/fish> fish -c 'seq -- 10 -1 5'
> open: No such file or directory
> codemon...@daves-mbp ~/W/fish>
>
> Now the really cool part . . if I create the file, it fails silently:
>
> > touch -- '--'
> > fish -c 'seq -- 10 -1 5'
> >
>
> Output from dtruss (I put the string "testing" into the file):
>
> 72372/0x27e1a2: open("--\0", 0x0, 0xFC080) = 4 0
> 72372/0x27e1a2: write(0x3, "BARRIER\n\0", 0x8) = 8 0
> 72359/0x27e17a: select(0x4, 0x7FFF5FBFF7E0, 0x7FFF5FBFF760, 0x0, 0x0)
> = 1 0
> 72359/0x27e17a: read(0x1, "BARRIER\n\0", 0x400) = 8 0
> 72359/0x27e17a: write(0x1, "BARRIER_REPLY\n\0", 0xE) = 14 0
> dtrace: error on enabled probe ID 1754 (ID 18467: syscall::read:return):
> out of scratch space in action #13 at DIF offset 44
> 72372/0x27e1a2: select(0x4, 0x7FFF5FBFF670, 0x0, 0x0, 0x0) = 1 0
> 72372/0x27e1a2: read(0x3, "BARRIER_REPLY\n\0", 0x400) = 14 0
> dtrace: error on enabled probe ID 1754 (ID 18467: syscall::read:return):
> out of scratch space in action #13 at DIF offset 44
> 72372/0x27e1a2: open_nocancel(".\0", 0x0, 0x0) = 5 0
> 72372/0x27e1a2: fstat64(0x5, 0x7FFF5FBFD360, 0x0) = 0 0
> 72372/0x27e1a2: fcntl_nocancel(0x5, 0x32, 0x7FFF5FBFD580) = 0 0
> 72372/0x27e1a2: close_nocancel(0x5) = 0 0
> 72372/0x27e1a2: stat64("/Users/codemonkey/Work/fish\0", 0x7FFF5FBFD2D0,
> 0x0) = 0 0
> 72372/0x27e1a2: stat64("/Users/codemonkey/Work/fish\0", 0x7FFF5FBFDA10,
> 0x3F8) = 0 0
> 72372/0x27e1a2: getattrlist("/Users/codemonkey/Work/fish/--\0",
> 0x7FFF70859100, 0x7FFF5FBFE320) = 0 0
> 72372/0x27e1a2: fcntl_nocancel(0x4, 0x3, 0x0) = 0 0
> 72372/0x27e1a2: fstat64(0x4, 0x7FFF5FBFE5A0, 0x7FFF5FBFE66C) = 0 0
> 72372/0x27e1a2: read_nocancel(0x4, "testing\n\0", 0x1000) = 8 0
> 72372/0x27e1a2: read_nocancel(0x4, "\0", 0x1000) = 0 0
> 72372/0x27e1a2: close_nocancel(0x4) = 0 0
>
>
> Running the command with debug doesn't show anything useful either:
>
> fish --debug-level=10 -c 'seq 10 -1 5'
> and
> fish --debug-level=10 -c 'seq -- 10 -1 5'
>
> Something is going on really strangely. . . perhaps incompatible versions
> of getopt?
>
>
>
>
>
>
> When I run truss (strace) on it, in the 2nd case, it's actually trying to
> open a file named --
>
>
> On Fri, Apr 2, 2010 at 12:50 AM, Suraj Kurapati <[email protected]> wrote:
>
>> On Thu, Apr 1, 2010 at 6:58 PM, [email protected] <[email protected]>
>> wrote:
>> > I'm trying to use seq to count backwards from 10 down to 5 in increments
>> > of 1 (os x 10.6.3)
>> >
>> > $ seq 10 -1 5
>> > fish: invalid option -- 1
>> >
>> > Does anyone else get the same error?
>>
>> s...@yantram ~> seq 10 -1 5
>> 10
>> 9
>> 8
>> 7
>> 6
>> 5
>>
>> s...@yantram ~> fish --version
>> fish, version 1.23.1
>>
>> s...@yantram ~> uname -a
>> Linux yantram 2.6.32-ARCH #1 SMP PREEMPT Mon Mar 15 20:08:25 UTC 2010
>> i686 Intel(R) Atom(TM) CPU 330 @ 1.60GHz GenuineIntel GNU/Linux
>>
>>
>> ------------------------------------------------------------------------------
>> Download Intel® Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Fish-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/fish-users
>>
>
>
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users