Hi people,

I've encountered a similar (nearly identicle) problem to the poster of
the original bug, for example, using dchroot-0.11:

$ dchroot echo bla
(gen32) echo bla 
echo: /usr/bin/echo: cannot execute binary file
dchroot: Child exited non-zero.
dchroot: Operation failed.

On the other hand, dchroot with no arguments drops me into a perfectly
usable shell in my 32 bit system.

After spending a few hours understanding the chain of programs which are
called by dchroot, this is what I come up with:

1) In the case in question dchroot calls su as follows:
/bin/su - username -- echo bla

2) This causes su to call the default login shell (bash) for my username
as follows:
/bin/bash -- echo bla

3) Bash interprets this as "run the script file /bin/echo with argument bla"
and complains as a result that it "cannot execute binary file"

So, either the documentation should state that dchroot is *only* designed
to take scripts to execute (generally unsatisfactory in my opinion) or
the following trivial diff performs what I'd consider a fix; it causes
execution of commands with bash -c "command":

$ diff -u dchroot.c.old dchroot.c
--- dchroot.c.old       2005-04-30 02:09:35.000000000 +1000
+++ dchroot.c   2005-04-30 03:24:48.000000000 +1000
@@ -258,7 +258,7 @@
                        }
                        
                        cmd[i++] = username;
-                       cmd[i++] = "--";
+                       cmd[i++] = "-c";
 
                        while (argv[j] != NULL) {
                                cmd[i++] = argv[j];


I admit that I'm not sure what the purpose of the -- argument is in
fact.  The bash man page explains that "--" ends processing of options,
but I don't know why you'd want to do this.  Anyhow, the fix should be
something along these lines...

Final note: my system is an amd64 gentoo box running the kernel 2.6.11-gentoo-r3
with glibc-2.3.4

Hope this helps,
Chris F.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to