oils-for-unix / oils

Oils is our upgrade path from bash to a better language and runtime. It's also for Python and JavaScript users who avoid shell!
http://www.oilshell.org/
Other
2.86k stars 159 forks source link

Run bzip2 configure (backticks and here doc incompatibility) #1050

Open andychu opened 2 years ago

andychu commented 2 years ago

https://oilshell.zulipchat.com/#narrow/stream/307442-nix/topic/export.20append.20problem

andychu commented 2 years ago

basically this command is being run

$configureScript "${flagsArray[@]}"

which is './configure' --disable-static --disable-dependency-tracking '--prefix=/nix/store/3z0qdpzc3h7ikvb2z7aalz2qgvzx3kmv-bzip2-1.0.6.0.2' '--bindir=/nix/store/199szl1pik7lqzpx051bq9y4srf8fqgz-bzip2-1.0.6.0.2-bin/bin' '--sbindir=/nix/store/199szl1pik7lqzpx051bq9y4srf8fqgz-bzip2-1.0.6.0.2-bin/sbin' '--includedir=/nix/store/4l40n8qf2bfvk21ah1544aa1gjc5xyx7-bzip2-1.0.6.0.2-dev/include' '--oldincludedir=/nix/store/4l40n8qf2bfvk21ah1544aa1gjc5xyx7-bzip2-1.0.6.0.2-dev/include' '--mandir=/nix/store/gdzg6x0547k3xddflg8l1caj21y40fj1-bzip2-1.0.6.0.2-man/share/man' '--infodir=/nix/store/199szl1pik7lqzpx051bq9y4srf8fqgz-bzip2-1.0.6.0.2-bin/share/info' '--docdir=/nix/store/3z0qdpzc3h7ikvb2z7aalz2qgvzx3kmv-bzip2-1.0.6.0.2/share/doc/bzip2' '--libdir=/nix/store/3z0qdpzc3h7ikvb2z7aalz2qgvzx3kmv-bzip2-1.0.6.0.2/lib' '--libexecdir=/nix/store/3z0qdpzc3h7ikvb2z7aalz2qgvzx3kmv-bzip2-1.0.6.0.2/libexec' '--localedir=/nix/store/3z0qdpzc3h7ikvb2z7aalz2qgvzx3kmv-bzip2-1.0.6.0.2/share/locale'

and that triggers some error

+ cat
+ exec
  /bin/arch              = `(/bin/arch) 2>/dev/null exec 5>>config.log
                                ^
[ backticks in './configure' ]:1785: Couldn't find terminator for here doc that starts here
andychu commented 2 years ago

Hm this bug isn't tickled with plain ./configure -- I guess I need all the flags?

andychu commented 2 years ago

@happysalada As mentioned it will help if you can minimize this test case

But maybe the other fixes will unblock other stuff first

https://oilshell.zulipchat.com/#narrow/stream/307442-nix/topic/Tagged.204.20Bugs.20Nix

happysalada commented 2 years ago

Understood, I will add the exact source and the command to reproduce the issue. This is coming from a modifed source of bzip2 using autotools.

happysalada commented 2 years ago

bzip2-1.0.6.0.2.tar.gz

This is the bzip folder used to build in nix. It contains a ./configure file, with a shebang for sh interpretation. executing the file with /bin/sh works fine. Changing the shebang to interpret with osh will show interpretation errors.

andychu commented 2 years ago

Hm I'm not able to reproduce.

I untarred and changed the shebang. And then I ran with the command line above.

Maybe it depends on those directories actually existing or the state of the file system?

$ head configure
#! /usr/bin/env osh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bzip2 1.0.6.0.2.
#
# Report bugs to <Julian Seward <jseward@bzip.org>>.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
andy@lenny:~/git/oilshell/oil/_tmp/1050/bzip2-1.0.6.0.2$ ./configure --disable-static --disable-dependency-tracking '--prefix=/nix/store/3z0qdpzc3h7ikvb2z7aalz2qgvzx3kmv-bzip2-1.0.6.0.2' '--bindir=/nix/store/199szl1pik7lqzpx051bq9y4srf8fqgz-bzip2-1.0.6.0.2-bin/bin' '--sbindir=/nix/store/199szl1pik7lqzpx051bq9y4srf8fqgz-bzip2-1.0.6.0.2-bin/sbin' '--includedir=/nix/store/4l40n8qf2bfvk21ah1544aa1gjc5xyx7-bzip2-1.0.6.0.2-dev/include' '--oldincludedir=/nix/store/4l40n8qf2bfvk21ah1544aa1gjc5xyx7-bzip2-1.0.6.0.2-dev/include' '--mandir=/nix/store/gdzg6x0547k3xddflg8l1caj21y40fj1-bzip2-1.0.6.0.2-man/share/man' '--infodir=/nix/store/199szl1pik7lqzpx051bq9y4srf8fqgz-bzip2-1.0.6.0.2-bin/share/info' '--docdir=/nix/store/3z0qdpzc3h7ikvb2z7aalz2qgvzx3kmv-bzip2-1.0.6.0.2/share/doc/bzip2' '--libdir=/nix/store/3z0qdpzc3h7ikvb2z7aalz2qgvzx3kmv-bzip2-1.0.6.0.2/lib' '--libexecdir=/nix/store/3z0qdpzc3h7ikvb2z7aalz2qgvzx3kmv-bzip2-1.0.6.0.2/libexec' '--localedir=/nix/store/3z0qdpzc3h7ikvb2z7aalz2qgvzx3kmv-bzip2-1.0.6.0.2/share/locale'

...


checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking whether the -Werror option is usable... yes
checking for simple visibility declarations... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking whether compiler understands -Wall... yes
checking whether compiler understands -Winline... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating bzip2.pc
config.status: executing depfiles commands
config.status: executing libtool commands
happysalada commented 2 years ago

thanks for testing, let me dig more into what steps are needed to reproduce. I'll report back when I've found more.