classification
Title: 2.5.4.3 / test_posix failing on HPUX systems
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: adiroiban, andreask, neologix, pitrou, python-dev, r.david.murray, vstinner
Priority: normal Keywords: needs review, patch

Created on 2009-01-30 20:12 by andreask, last changed 2012-04-17 18:03 by neologix. This issue is now closed.

Files
File name Uploaded Description Edit
bug-test_posix-hpux.log andreask, 2009-01-30 20:12 Output of regrtest.py -v test_posix
chown_hpux.diff neologix, 2011-07-27 19:15 review
chown_hpux-3.diff vstinner, 2011-08-24 22:50 review
Messages (22)
msg80835 - (view) Author: Andreas Kupries (andreask) Date: 2009-01-30 20:12
The 'test_posix' of Python's 2.5.4.3 testsuite fails on HPUX. This has
happened on parisc and ia64 systems. On the parisc system failure occurs
for both parisc1.1 and parisc2.0w builds. The HPUX versions are 11.00
(parisc) and 11.22 (ia64).

The attached file contains the output of executing

./apy/bin/python2.5 ./apy/lib/python2.5/test/regrtest.py -v test_posix
msg80913 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-02-01 18:09
If you try "chown root foobar", with <foobar> being a valid file you
own, does it succeed?
msg80973 - (view) Author: Andreas Kupries (andreask) Date: 2009-02-02 18:19
Yes.

Session log:

andreask@bertha:~/tmp/x> ll
total 0

andreask@bertha:~/tmp/x> touch foobar
andreask@bertha:~/tmp/x> ll
total 0
-rw-rw-r--   1 andreask   DomainUsers      0 Feb  2 10:17 foobar

andreask@bertha:~/tmp/x> chown root foobar
andreask@bertha:~/tmp/x> ll
total 0
-rw-rw-r--   1 root       DomainUsers      0 Feb  2 10:17 foobar
msg80976 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-02-02 18:25
That explains what the test fails then. The test expects that you can't
chown a file to root as a normal user, and it verifies that an exception
is raised in that case.
Do you know if this behaviour is standard under HP-UX? If so, what do
sys.platform and platform.system() return?

(this won't be fixed in 2.5 by the way: 2.5 only receives security
fixes. 2.6 is the current stable branch and 2.7 is the in-development
version)
msg81012 - (view) Author: Andreas Kupries (andreask) Date: 2009-02-02 22:42
I do not know if this is standard for hpux or not.

I can say that right now we have six different HPUX machines which
behave in this manner, i.e. do not throw an error for the 'chown root
foobar' command for an ordinary (non-root) user.

Regarding the platform codes, here are the results.

andreask@bertha:~/tmp/autotest> ./apy/bin/python2.5
ActivePython 2.5.4.3 (ActiveState Software Inc.) based on
Python 2.5.4 (r254:67916, Jan 20 2009, 14:48:58) [C] on hp-ux11
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, platform
>>> sys.platform
'hp-ux11'
>>> platform.system()
'HP-UX'
>>> quit()

The six machines I mentioned are

bertha   - HP-UX 11.00 (PA-RISC)
bigsur03 - HP-UX 11.22 (Itanium)
hpa180   - HP-UX 11.00 (PA-RISC)
bigsur03 - HP-UX 11.22 (Itanium)
hpl3000  - HP-UX 11.23 (PA-RISC)
bigsur05 - HP-UX 11.32 (Itanium)
msg81014 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-02-02 23:00
Ok, and when you try to chown back to yourself the root-owned foobar,
does it fail?
msg81015 - (view) Author: Andreas Kupries (andreask) Date: 2009-02-02 23:07
Yes, that does fail with error 'not owner'.

andreask@bertha:~/tmp> mkdir x
andreask@bertha:~/tmp> cd x
andreask@bertha:~/tmp/x> touch foobar
andreask@bertha:~/tmp/x> ll
total 0
-rw-rw-r--   1 andreask   DomainUsers      0 Feb  2 15:06 foobar
andreask@bertha:~/tmp/x> chown root foobar
andreask@bertha:~/tmp/x> ll
total 0
-rw-rw-r--   1 root       DomainUsers      0 Feb  2 15:06 foobar
andreask@bertha:~/tmp/x> chown andreask foobar
foobar: Not owner
andreask@bertha:~/tmp/x>
msg116648 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2010-09-17 08:52
Actually, looking at the man page, this seems to be normal:

---
In order to change the owner or group, you must own the file and have the CHOWN privilege (see setprivgrp(1M)). [...] Note that a given user's or group's ability to use this command can be restricted by setprivgrp (see setprivgrp(1M)).
---

So depending on the setting of setprivgrp, chown'ing a file to root may be allowed or not.
It might be a good idea to skip this test on HP-UX. Solaris apparently behaves in the same way.
msg141267 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2011-07-27 19:15
Patch attached.
msg142938 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-08-24 22:49
It's surprising to raise a SkipTest *at the end* of the test. Here is another patch.
msg142940 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-08-24 22:53
Using chown_hpux-4.diff, we don't skip anything on HP-UX.
msg142944 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2011-08-24 22:59
> Using chown_hpux-4.diff, we don't skip anything on HP-UX.

Victor, I don't understand your patch: if we try chown()ing a file to root, then this will fail on HP-UX (because chown won't fail with EPERM). That's the whole point of the patch.
msg142945 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-08-24 23:02
> if we try chown()ing a file to root, then this will fail on HP-UX

Oooh, I'm confused. I removed this stupid patch.
msg142946 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-08-24 23:04
# HP-UX and Solaris allow a non-root user to chown to root

I didn't see failure on our Solaris / OpenIndiana buildbot. Should we really skip the test on Solaris?
msg142948 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2011-08-24 23:15
Well, IIRC, I read in the Solaris man pages that it behaves like HP-UX
in this regard. But this it can be changed with `setprivgrp`, so it
might work on some machines, and fail on others.
According to http://unix.derkeiler.com/Newsgroups/comp.unix.solaris/2004-03/2579.html,
the test should work with the default setting (maybe the OP was
testing on a HP-UX machine with the non-default setting).
Anyway, since it depends on the system configuration, I wanted to stay
on the safe side, and just skip on both OS.
But I honestly don't have a strong opinion about this.
msg142985 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2011-08-25 18:34
> Oooh, I'm confused. I removed this stupid patch.

chown_hpux-3.diff has a problem too: it skips the successful chown call (that's why I put the SkipTest at the end).
msg158152 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2012-04-12 16:45
Adi, since you have access to an HP-UX box, could you test the attached patch (chown_hpux.diff)?
Also, if you're interested, you could search for other isues HP-UX-specific to see if you can help.
msg158155 - (view) Author: Adi Roiban (adiroiban) Date: 2012-04-12 17:43
Hi,

Not sure what codebase was used for the patch.

I have manually patched the test on 2.5.6 and the test_posix tests passed.

Thanks!
Adi
msg158179 - (view) Author: Adi Roiban (adiroiban) Date: 2012-04-12 22:04
I am not sure how the search works, but for example I was not able to reach http://bugs.python.org/issue5895 while searching for hpux or hp-ux using the internal search.

Also I was not able to find any aix or solaris bug.

In case you bump over an hpux, aix, solaris bug, please add me to the noisy list and I will take a look.

Thanks!
Adi
msg158181 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-04-12 22:31
Search is currently not returning all matching issues, unfortunately.  You might get a few more hits by searching for hpux in the title field via advanced search.
msg158562 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-04-17 17:59
New changeset 8a4c9a168d09 by Charles-François Natali in branch '2.7':
Issue #5113: Fix a test_posix failure on HP-UX, where non-root users can
http://hg.python.org/cpython/rev/8a4c9a168d09

New changeset 428bece48029 by Charles-François Natali in branch '3.2':
Issue #5113: Fix a test_posix failure on HP-UX, where non-root users can
http://hg.python.org/cpython/rev/428bece48029

New changeset 3d4922cf0d65 by Charles-François Natali in branch 'default':
Issue #5113: Fix a test_posix failure on HP-UX, where non-root users can
http://hg.python.org/cpython/rev/3d4922cf0d65
msg158563 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2012-04-17 18:03
Committed, thanks.
History
Date User Action Args
2012-04-17 18:03:15neologixsetstatus: open -> closed
versions: - Python 2.6
messages: + msg158563

resolution: fixed
stage: patch review -> resolved
2012-04-17 17:59:30python-devsetnosy: + python-dev
messages: + msg158562
2012-04-12 22:31:46r.david.murraysetnosy: + r.david.murray
messages: + msg158181
2012-04-12 22:04:48adiroibansetmessages: + msg158179
2012-04-12 17:43:45adiroibansetmessages: + msg158155
2012-04-12 16:45:28neologixsetmessages: + msg158152
2012-04-12 02:08:15adiroibansetnosy: + adiroiban
2011-08-25 18:34:45neologixsetmessages: + msg142985
2011-08-24 23:15:27neologixsetmessages: + msg142948
2011-08-24 23:04:10vstinnersetmessages: + msg142946
2011-08-24 23:02:25vstinnersetmessages: + msg142945
2011-08-24 23:01:13vstinnersetfiles: - chown_hpux-4.diff
2011-08-24 22:59:39neologixsetmessages: + msg142944
2011-08-24 22:53:19vstinnersetmessages: + msg142940
2011-08-24 22:52:18vstinnersetfiles: + chown_hpux-4.diff
2011-08-24 22:50:31vstinnersetfiles: - chown_hpux-2.diff
2011-08-24 22:50:19vstinnersetfiles: + chown_hpux-3.diff
2011-08-24 22:49:01vstinnersetfiles: + chown_hpux-2.diff

messages: + msg142938
2011-08-24 19:47:24neologixsetnosy: + vstinner
2011-07-27 19:15:20neologixsetfiles: + chown_hpux.diff
versions: + Python 3.2, Python 3.3
messages: + msg141267

keywords: + patch, needs review
stage: patch review
2010-09-17 08:52:21neologixsetnosy: + neologix
messages: + msg116648
2009-02-02 23:07:46andreasksetmessages: + msg81015
2009-02-02 23:00:51pitrousetmessages: + msg81014
2009-02-02 22:42:01andreasksetmessages: + msg81012
2009-02-02 18:25:26pitrousetmessages: + msg80976
versions: + Python 2.6, Python 2.7, - Python 2.5
2009-02-02 18:19:47andreasksetmessages: + msg80973
2009-02-01 18:09:28pitrousetnosy: + pitrou
messages: + msg80913
2009-01-30 20:12:12andreaskcreate