Bug 811363 - lua rpm scripts do not properly restore path after running
Summary: lua rpm scripts do not properly restore path after running
Keywords:
Status: CLOSED DUPLICATE of bug 746190
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: rpm
Version: 6.2
Hardware: x86_64
OS: Linux
unspecified
urgent
Target Milestone: rc
: ---
Assignee: Panu Matilainen
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-04-10 19:51 UTC by Chris Seawood
Modified: 2015-01-19 09:13 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-07-02 07:50:04 UTC
Target Upstream Version:


Attachments (Terms of Use)
testbar.spec (695 bytes, text/plain)
2012-04-10 19:51 UTC, Chris Seawood
no flags Details
testfoo.spec (513 bytes, text/plain)
2012-04-10 19:52 UTC, Chris Seawood
no flags Details
fix chroot handling for lua scripts (1.72 KB, patch)
2012-04-10 19:53 UTC, Chris Seawood
no flags Details | Diff
lua script chroot v1.1 (1.86 KB, patch)
2012-04-13 03:53 UTC, Chris Seawood
no flags Details | Diff

Description Chris Seawood 2012-04-10 19:51:17 UTC
In EL6.2, there are a handful of rpms that use lua for rpm %post/%postun scripts.  When these rpms are upgraded manually using 'rpm -Uv', rpm complains that it cannot find the rest of the rpms after processing the first rpm that uses a lua script.  Using yum works but it's not always an option.

I've attached 2 proof of concept rpm spec files which will show the problem. To reproduce, build the rpms and run: 
     cd /path/to/rpms && rpm -Uvh test{foo,bar}*.rpm

The output looks like this:

[root@optimus ~]# ls
anaconda-ks.cfg  install.log.syslog  testbar-1.0-1.sc00.x86_64.rpm
install.log      ks-post.log         testfoo-1.0-1.sc00.x86_64.rpm
[root@optimus ~]# rpm -Uvh test*.rpm
Preparing...                ########################################### [100%]
   1:testfoo                ########################################### [ 50%]
Tue 10 Apr 2012 11:52:46 AM PDT
error: open of testbar-1.0-1.sc00.x86_64.rpm failed: No such file or directory


runLuaScript() doesn't properly reset the current working directory after running the lua script.  The attached patch fixes the problem for me.

[root@optimus ~]# rpm -e testfoo
[root@optimus ~]# rpm -Uvh test*.rpm
Preparing...                ########################################### [100%]
   1:testfoo                ########################################### [ 50%]
Tue 10 Apr 2012 12:33:55 PM PDT
   2:testbar                ########################################### [100%]

Comment 1 Chris Seawood 2012-04-10 19:51:52 UTC
Created attachment 576575 [details]
testbar.spec

Comment 2 Chris Seawood 2012-04-10 19:52:18 UTC
Created attachment 576576 [details]
testfoo.spec

Comment 3 Chris Seawood 2012-04-10 19:53:07 UTC
Created attachment 576577 [details]
fix chroot handling for lua scripts

Comment 5 Chris Seawood 2012-04-13 03:53:39 UTC
Created attachment 577219 [details]
lua script chroot v1.1

The previous patch broke mock.  Apparently, the result of rpmtsCurrDir() cannot be trusted and I had to use getcwd() instead.

Comment 6 Panu Matilainen 2012-04-16 10:25:51 UTC
This is a dupe of bug 746190 (which is a closed bug, for whatever reason). In any case, its being addressed.

Comment 7 RHEL Program Management 2012-05-03 05:17:18 UTC
Since RHEL 6.3 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 8 Panu Matilainen 2012-07-02 07:50:04 UTC
This has been fixed as of http://rhn.redhat.com/errata/RHBA-2012-0909.html

*** This bug has been marked as a duplicate of bug 746190 ***

Comment 9 Panu Matilainen 2015-01-19 09:05:53 UTC
Clearing up leftover review flag


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