Bug 1159300 - running mock from chroot path directory produces "error retrieving current directory: getcwd"
Summary: running mock from chroot path directory produces "error retrieving current di...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1159947
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-31 12:25 UTC by Mikhail Campos
Modified: 2015-01-06 02:06 UTC (History)
6 users (show)

Fixed In Version: mock-1.2.3-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-12-12 04:07:52 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
patch for handling getcwd() error when we are calling mock from chroot path (1.31 KB, text/plain)
2014-10-31 12:25 UTC, Mikhail Campos
no flags Details
log file attached (3.70 KB, text/plain)
2014-10-31 12:27 UTC, Mikhail Campos
no flags Details
error in output is still present (1.35 KB, text/plain)
2014-11-03 14:10 UTC, Mikhail Campos
no flags Details

Description Mikhail Campos 2014-10-31 12:25:29 UTC
Created attachment 952474 [details]
patch for handling getcwd() error when we are calling mock from chroot path

Description of problem:
When root cache is present and we are trying to run mock from /var/lib/mock/{chroot}, mock fails on os.getcwd().

Version-Release number of selected component (if applicable):
1.2.0-1

How reproducible:
Try to run mock --rebuild (without --no-clean) from /var/lib/mock/{chroot} when root cache was created.

Steps to Reproduce:
1. mock --init
2. cd /var/lib/mock/fedoraXXX
3. mock --rebuild /path/to/src/XXX.src.rpm

Actual results:
Getting "OSError: [Errno 2] No such file or directory".

Expected results:
Rebuilding src.rpm as usual

Additional info:
Can be catched by additional early checking of current directory and printing more friendly output.

Comment 1 Mikhail Campos 2014-10-31 12:27:58 UTC
Created attachment 952476 [details]
log file attached

Comment 2 Miroslav Suchý 2014-10-31 13:09:03 UTC
I can reproduce.

Comment 3 Miroslav Suchý 2014-11-03 12:38:57 UTC
Thank for the patch, it made my life easier. However there is no need to forbid it. Instead we can just chdir to some / or /tmp or somwhere else, which exatly that does mockbuild.util.find_non_nfs_dir()

Commited as 8bc6d24

Comment 4 Mikhail Campos 2014-11-03 14:08:31 UTC
Hm, but we still can see 'error retrieving current directory: getcwd: cannot access parent directories: No such file or directory' during the build prepare stage

Comment 5 Mikhail Campos 2014-11-03 14:10:24 UTC
Created attachment 953126 [details]
error in output is still present

Comment 6 Mikhail Campos 2014-11-03 16:18:55 UTC
After a little investigation, it seems that error located in buildroot.py:_setup_dbus_uuid and appears on uuid module loading.

Also, every time getcwd() is called in different places we need to add extra check-code . Maybe it is better to do check once?

Comment 7 Miroslav Suchý 2014-11-03 16:40:21 UTC
Right, my investigation ended with same result. I will file BZ on python. 

Hhmm I will try to move thet to util.py module and make some wrapper aroudn getcwd(), it is used on just two other places.

Comment 8 Miroslav Suchý 2014-11-03 17:15:11 UTC
Created util.pretty_getcwd(), which will try to use getcwd() or orginal path when mock was started or find_non_nfs_dir() as last resort.

All instances of getcwd() was edited to util.pretty_getcwd()

Commited as 7f347a7

Comment 9 Fedora Update System 2014-11-16 17:37:19 UTC
mock-1.2.1-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/mock-1.2.1-1.fc21

Comment 10 Fedora Update System 2014-11-16 17:38:43 UTC
mock-1.2.1-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/mock-1.2.1-1.fc20

Comment 11 Fedora Update System 2014-11-16 17:39:34 UTC
mock-1.2.1-1.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/mock-1.2.1-1.el7

Comment 12 Fedora Update System 2014-11-16 17:40:33 UTC
mock-1.2.1-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.2.1-1.el6

Comment 13 Fedora Update System 2014-11-17 06:29:39 UTC
Package mock-1.2.1-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing mock-1.2.1-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-15217/mock-1.2.1-1.fc20
then log in and leave karma (feedback).

Comment 14 Fedora Update System 2014-12-04 12:06:57 UTC
mock-1.2.3-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/mock-1.2.3-1.fc21

Comment 15 Fedora Update System 2014-12-04 12:10:27 UTC
mock-1.2.3-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/mock-1.2.3-1.fc20

Comment 16 Fedora Update System 2014-12-04 12:11:24 UTC
mock-1.2.3-1.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/mock-1.2.3-1.el7

Comment 17 Fedora Update System 2014-12-12 04:07:52 UTC
mock-1.2.3-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 18 Fedora Update System 2014-12-17 04:42:56 UTC
mock-1.2.3-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 19 Fedora Update System 2015-01-06 02:06:41 UTC
mock-1.2.3-1.el7 has been pushed to the Fedora EPEL 7 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.