All of lore.kernel.org
 help / color / mirror / Atom feed
* Command parsing problem and tracefile
@ 2012-06-08 16:58 Richard H Lee
  2012-06-08 17:17 ` Jonathan Nieder
  0 siblings, 1 reply; 4+ messages in thread
From: Richard H Lee @ 2012-06-08 16:58 UTC (permalink / raw)
  To: dash

Dash mailing list,

I have one issue with dash and one question regarding debugging.

First up, when I run a configure script and it hits the following line:
if $_pkg_config --exists --print-errors $all_libav_libs ; then

with $_pkg_config being 'pkg-config --static', dash throws the following 
error:
./configure: 6012: ./configure: pkg-config --static: not found

I've tried adding brackets around the condition, but with no avail. Is 
there anything wrong with the syntax.

Secondly, I decided to delve deeper with gdb and I can see dash calling:
find_command('pkg-config --static')

I would like to get some more info as to what in going on. IIRC, I saw 
in show.c, there was some sort for tracefile that dash to dump to. How 
do I enable this?


Richard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Command parsing problem and tracefile
  2012-06-08 16:58 Command parsing problem and tracefile Richard H Lee
@ 2012-06-08 17:17 ` Jonathan Nieder
  2012-06-08 21:20   ` Richard H Lee
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Nieder @ 2012-06-08 17:17 UTC (permalink / raw)
  To: Richard H Lee; +Cc: dash

Hi Richard,

Richard H Lee wrote:

> First up, when I run a configure script and it hits the following line:
> if $_pkg_config --exists --print-errors $all_libav_libs ; then
>
> with $_pkg_config being 'pkg-config --static', dash throws the
> following error:
> ./configure: 6012: ./configure: pkg-config --static: not found

Thanks for writing.  Who is setting _pkg_config to 'pkg-config
--static', what are they trying to do, and can it be done another way?

This doesn't look like a dash-specific phenomenon.  I get the same
result with

	$ "pkg-config --static" foo bar
	dash: 1: pkg-config --static: not found

which looks right to me.  (You can test with 'CONFIG_SHELL=/bin/ksh
ksh ./configure'.)

[...]
> I would like to get some more info as to what in going on. IIRC, I
> saw in show.c, there was some sort for tracefile that dash to dump
> to. How do I enable this?

"dash -o debug" after a compile with DEBUG enabled.  Though "dash -x"
tends to be more helpful if you are debugging a shell script rather
than trying to find a bug in dash itself.

Hope that helps,
Jonathan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Command parsing problem and tracefile
  2012-06-08 17:17 ` Jonathan Nieder
@ 2012-06-08 21:20   ` Richard H Lee
  2012-06-08 21:30     ` Jonathan Nieder
  0 siblings, 1 reply; 4+ messages in thread
From: Richard H Lee @ 2012-06-08 21:20 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: dash

Hi Jonathan,

On 08/06/12 18:17, Jonathan Nieder wrote:
> Thanks for writing.  Who is setting _pkg_config to 'pkg-config
> --static', what are they trying to do, and can it be done another way?

I'm compiling mplayer2. I'm basically running ./configure 
--enable-static . I assume without the --enable-static flag the 
configure script sets _pkg_config to just 'pkg-config' .

I want to try and statically compile it as there is a bug with one of 
the libraries. So I'm planning to compile a modified libav library first 
and then compile mplayer2 statically against them. I guess I could do it 
dynamically, but then I would have modified libraries floating around my 
system.

> This doesn't look like a dash-specific phenomenon.  I get the same
> result with
>
> 	$ "pkg-config --static" foo bar
> 	dash: 1: pkg-config --static: not found
>
> which looks right to me.  (You can test with 'CONFIG_SHELL=/bin/ksh
> ksh ./configure'.)

[Note: I don't think CONFIG_SHELL is used here as the configure script 
is not autotools generated.]

It didn't occur to me to try other shells. I get the same error with 
bash. It makes me wonder why it occurs on three different shells? Is 
this defined behaviour? Or they just happen to share the same parsing 
code/algorithm.

I also tried running the following script:
<<EOF
#!/bin/sh
_pkg_config='pkg-config --static'
if $_pkg_config --exists --print-errors libavutil ; then
   echo success
fi
EOF

Which does print out 'success' (replace libavutil with any other 
pkg-config library you have installed). I get the feeling, some sort of 
flag was set that changes the parsing behaviour in the configure script.

>> I would like to get some more info as to what in going on. IIRC, I
>> saw in show.c, there was some sort for tracefile that dash to dump
>> to. How do I enable this?
>
> "dash -o debug" after a compile with DEBUG enabled.  Though "dash -x"
> tends to be more helpful if you are debugging a shell script rather
> than trying to find a bug in dash itself.

 From shell.h:
define DEBUG=1 to compile in debugging ('set -o debug' to turn on)
define DEBUG=2 to compile in and turn on debugging.
When debugging is on, debugging info will be written to ./trace and a 
quit signal will generate a core dump.

This is exactly what I was looking for.

As to compiling with DEBUG enabled, how would I do this?
I couldn't see any reference in dash's ./configure --help (nor any clear 
reference in the configure file itself).


Thanks,

Richard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Command parsing problem and tracefile
  2012-06-08 21:20   ` Richard H Lee
@ 2012-06-08 21:30     ` Jonathan Nieder
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Nieder @ 2012-06-08 21:30 UTC (permalink / raw)
  To: Richard H Lee; +Cc: dash

Richard H Lee wrote:

> It didn't occur to me to try other shells. I get the same error with
> bash. It makes me wonder why it occurs on three different shells?

Yes, that's because it's a bug in the configure script, not dash.

Your best bet is to contact whoever provided that configure script
and explain that --enable-static is not working for you.  The
specification that defines POSIX shell script syntax can be found at
<http://unix.org/2008edition/>.

Good luck,
Jonathan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-08 21:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-08 16:58 Command parsing problem and tracefile Richard H Lee
2012-06-08 17:17 ` Jonathan Nieder
2012-06-08 21:20   ` Richard H Lee
2012-06-08 21:30     ` Jonathan Nieder

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.