bug-bash
[Top][All Lists]
Advanced

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

Re: obscure bug "extern void free (void *__ptr) __attribute__ ((__nothro


From: Greg Wooledge
Subject: Re: obscure bug "extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));"
Date: Thu, 21 Jan 2021 16:36:56 -0500
User-agent: Mutt/1.10.1 (2018-07-13)

On Thu, Jan 21, 2021 at 10:27:54PM +0100, Mathias Steiger wrote:
> Suppose I wrote a simple script:
> 
>     {if echo "27ac5e2f757302" >& /dev/null; then echo "yes"; else echo "no";
> fi } > output

I count at least 3 bugs here, or 4 if you run this from something that
works around the exec format error by running sh rather than bash.

If this is supposed to be an actual script, then you need a shebang.
That's number one.

If you're going to use curly braces to turn the compound "if" command into
a command group, then you need a space after the first brace (that's two),
and you need a newline or semicolon or other command terminator before
the second brace (that's three).  Of course, you could fix both of those
by simply removing the curly braces entirely.

Finally, if you're writing this as an sh script, you cannot use the >&
operator for redirection.  That's a bashism.  That's number four, if
the missing shebang is #!/bin/sh.  If the missing shebang invokes bash,
then the >& operator is permitted, but I still wouldn't advise it.

When reporting a bug and showing an example script, it's best if the
example script actually *runs*, and ideally, produces the actual results
that you are reporting as a bug.

Just typing random malformed commands into an email as an "example"
does not help anyone.



reply via email to

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