Bug 135337 - [PATCH] emulators/linux_base-f10: incorrect bash usage
Summary: [PATCH] emulators/linux_base-f10: incorrect bash usage
Status: Closed Feedback Timeout
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-emulation (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-08 00:50 UTC by Dmitry Marakasov
Modified: 2014-08-31 17:16 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Marakasov 2009-06-08 00:50:00 UTC
Linux-base install bunch of scripts with #!/bin/bash shebang. That is obviously wrong.

Port maintainer (emulation@FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.77

Fix: 

Either:
- shebang should be changed to ${LINUXBASE}/bin/bash (but that won't work in chroot)
- the port should depend on native bash
- shebang should be changed to #!/bin/sh if there are no compatibility problems
How-To-Repeat: run /usr/compat/linux/usr/bin/ldd
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2009-06-08 00:50:11 UTC
Responsible Changed
From-To: freebsd-ports-bugs->emulation

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2009-06-14 01:26:52 UTC
Responsible Changed
From-To: emulation->freebsd-emulation

Canonicalize assignment.
Comment 3 Boris B.Samorodov 2009-08-08 15:48:29 UTC
Yep, the first suggestion won't work at chroot.
Your second workaround should be added with "... and create a link
/usr/local/bin/bash -> /bin/bash". Not good either.
The third one does not work. :-(

The best I can advice here is to use linux interpreter at command
line (so it won't be evaluated while running the script):
-----
% /compat/linux/bin/sh /compat/linux/usr/bin/ldd /compat/linux/lib/libz.so.1
        libc.so.6 => /lib/libc.so.6 (0x2bc39000)
        /lib/ld-linux.so.2 (0x00000000)
-----

If anyone knows/suggests a better solution/patches -- I'm all ears.

Thanks!

-- 
WBR, bsam
Comment 4 Dmitry Marakasov 2009-08-10 15:51:22 UTC
* Boris Samorodov (bsam@ipt.ru) wrote:
> If anyone knows/suggests a better solution/patches -- I'm all ears.

/usr/bin/env bash, perhaps?

-- 
Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3@amdmi3.ru  ..:  jabber: amdmi3@jabber.ru    http://www.amdmi3.ru
Comment 5 Boris B.Samorodov 2009-08-10 18:05:35 UTC
On Mon, 10 Aug 2009 18:51:22 +0400 Dmitry Marakasov wrote:
> * Boris Samorodov (bsam@ipt.ru) wrote:

> > If anyone knows/suggests a better solution/patches -- I'm all ears.
> /usr/bin/env bash, perhaps?

Whithout chroot the script will run as native FreeBSD script
and won't look for linux paths.

-- 
WBR, Boris Samorodov (bsam)
Comment 6 Dmitry Marakasov 2009-08-10 18:36:11 UTC
* Boris Samorodov (bsam@ipt.ru) wrote:

> Whithout chroot the script will run as native FreeBSD script
> and won't look for linux paths.

Yes. Why is that bad?

-- 
Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3@amdmi3.ru  ..:  jabber: amdmi3@jabber.ru    http://www.amdmi3.ru
Comment 7 Boris B.Samorodov 2009-08-10 20:15:58 UTC
On Mon, 10 Aug 2009 21:36:11 +0400 Dmitry Marakasov wrote:
> * Boris Samorodov (bsam@ipt.ru) wrote:

> > Whithout chroot the script will run as native FreeBSD script
> > and won't look for linux paths.

> Yes. Why is that bad?

It just doesn't help! ;-)
Well, at least not always. So it can't be a solution, just a new
workaround.

-----
% bash --version
GNU bash, version 4.0.24(0)-release (i386-portbld-freebsd8.0)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

% ls
file.1  file.2

% cat /compat/linux/usr/bin/test-ls
#!/usr/bin/env bash

listing=`dir $1`
echo $listing

% LANG=C /compat/linux/usr/bin/test-ls
/compat/linux/usr/bin/test-ls: line 3: dir: command not found
% /compat/linux/bin/bash /compat/linux/usr/bin/test-ls
file.1 file.2
-----

-- 
WBR, bsam
Comment 8 Alexander Best 2009-09-16 00:39:33 UTC
did anybody ever try the patch enclosed in this PR ?

http://www.freebsd.org/cgi/query-pr.cgi?pr=36952

does it fix the issue?

cheers.
alex
Comment 9 Edwin Groothuis freebsd_committer freebsd_triage 2010-09-14 19:43:34 UTC
Responsible Changed
From-To: freebsd-emulation->emulation

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 10 Alexander Best freebsd_committer freebsd_triage 2010-09-22 13:39:08 UTC
Responsible Changed
From-To: emulation->freebsd-emulation

Over to maintainer(s).
Comment 11 Baptiste Daroussin freebsd_committer freebsd_triage 2014-06-05 16:05:41 UTC
is this bug still relevant?