Bug 86619 - [linux] linux emulator interacts oddly with cp
Summary: [linux] linux emulator interacts oddly with cp
Status: Closed Unable to Reproduce
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 7.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-emulation (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-27 08:20 UTC by Daniel O'Connor
Modified: 2015-01-25 16:15 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel O'Connor 2005-09-27 08:20:16 UTC
The Linux cp command (at least with suse-9.3) interacts oddly with the Linux 
emualtor, ie
[inchoate 12:19] ~ >touch /tmp/abc
[inchoate 12:19] ~ >ls -la /tmp/abc
-rw-r--r--  1 darius  wheel  0 Sep 27 12:19 /tmp/abc
[inchoate 12:19] ~ >/compat/linux/bin/cp.foo -p /tmp/abc /tmp/def
[inchoate 12:19] ~ >ls -la /tmp/def
-----wS---  1 darius  wheel  0 Sep 27 12:19 /tmp/def
[inchoate 12:20] ~ >rm -f /tmp/def
[inchoate 12:20] ~ >/compat/linux/bin/cp.foo -p /tmp/abc /tmp/def
[inchoate 12:20] ~ >ls -la /tmp/def
-rwsrwxrwx  1 darius  wheel  0 Sep 27 12:20 /tmp/def
Comment 1 Daniel O'Connor 2005-09-29 02:23:54 UTC
On Wednesday 28 September 2005 02:29, Andrew Bliznak wrote:
> Look like behaviour depends on cp binary
> gentoo:
> andrew@beef$ ldd /compat/linux/bin/cp
> /compat/linux/bin/cp:
> libc.so.6 => /lib/libc.so.6 (0x28075000)
> /lib/ld-linux.so.2 (0x28057000)
> debian:
> andrew@beef$ ldd /compat/linux/bin/cp
> /compat/linux/bin/cp:
> libacl.so.1 => /lib/libacl.so.1 (0x28070000)
> libc.so.6 => /lib/libc.so.6 (0x28077000)
> libattr.so.1 => /lib/libattr.so.1 (0x281aa000)
> /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x28055000)


Hmm, so RH & Gentoo are OK, but SUSE is not.

I have seen oddities while trying to build Gentoo stage 1 though - I could not 
get the most recent one to build. It would install binaries with whacky 
permissions.

linux_ktrace shows both creating the file with the same permissions (100644)
  1925 cp-rh8   CALL  linux_open(0xbfbfeaeb,0x8041,0x81a4)
  1925 cp-rh8   NAMI  "def"
  1925 cp-rh8   RET   linux_open 4

  1923 cp-suse9.3 CALL  linux_open(0xbfbfeaeb,0x8041,0x81a4)
  1923 cp-suse9.3 NAMI  "def"
  1923 cp-suse9.3 RET   linux_open 4

However the SUSE binary chown's the file
  1923 cp-suse9.3 CALL  linux_chmod(0xbfbfeaeb,0xbfbfe430)
  1923 cp-suse9.3 NAMI  "def"
  1923 cp-suse9.3 RET   linux_chmod 0

Obviously the chmod is broken..
It looks like it's passing a pointer as the mode_t (!)

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
Comment 2 Daniel O'Connor 2005-09-30 03:03:43 UTC
On Thursday 29 September 2005 18:23, Andrew Bliznak wrote:
> > I have seen oddities while trying to build Gentoo stage 1 though - I
> > could not
> > get the most recent one to build. It would install binaries with whacky
> > permissions.
>
> I think acl is main problem. Try disable acl support in linux distribution


I'm not sure that is true. The RH8.0 binary has ACL support (well it's linked 
to it) yet it does not exhibit this problem.

> > However the SUSE binary chown's the file
> > 1923 cp-suse9.3 CALL linux_chmod(0xbfbfeaeb,0xbfbfe430)
> > 1923 cp-suse9.3 NAMI "def"
> > 1923 cp-suse9.3 RET linux_chmod 0
> >
> > Obviously the chmod is broken..
> > It looks like it's passing a pointer as the mode_t (!)


I don't know where I can get the SUSE9.3 ls source (well I do, but I suspect I 
will have to sift through a lot of stuff to get it in a useful form and/or be 
sure it's the source that actually went into building the binary)

PS you keep dropping the CC.

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
Comment 3 Alexander Best freebsd_committer freebsd_triage 2010-08-17 20:52:10 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-emulation

Over to maintainer(s).
Comment 4 Johannes Jost Meixner freebsd_committer freebsd_triage 2015-01-25 16:15:02 UTC
Can't reproduce it with cp(1) from CentOS 6.6, which behaves as intended:

xmj@mx12:~/repos/ports-svnssh$ ls -l /tmp/asdf
-rw-r--r--  1 xmj  wheel  9 Jan 25 18:12 /tmp/asdf
xmj@mx12:~/repos/ports-svnssh$ /compat/linux/bin/cp /tmp/asdf /tmp/qwer
xmj@mx12:~/repos/ports-svnssh$ ls -l /tmp/qwer
ls: /tmp/qwer: No such file or directory
xmj@mx12:~/repos/ports-svnssh$ ls -l /compat/linux/tmp/qwer
-rw-r--r--  1 xmj  wheel  9 Jan 25 18:13 /compat/linux/tmp/qwer