Bug 811363 - lua rpm scripts do not properly restore path after running
lua rpm scripts do not properly restore path after running
Status: CLOSED DUPLICATE of bug 746190
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: rpm (Show other bugs)
6.2
x86_64 Linux
unspecified Severity urgent
: rc
: ---
Assigned To: Panu Matilainen
BaseOS QE Security Team
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-10 15:51 EDT by Chris Seawood
Modified: 2015-01-19 04:13 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-07-02 03:50:04 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Chris Seawood 2012-04-10 15:51:17 EDT
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 15:51:52 EDT
Created attachment 576575 [details]
testbar.spec
Comment 2 Chris Seawood 2012-04-10 15:52:18 EDT
Created attachment 576576 [details]
testfoo.spec
Comment 3 Chris Seawood 2012-04-10 15:53:07 EDT
Created attachment 576577 [details]
fix chroot handling for lua scripts
Comment 5 Chris Seawood 2012-04-12 23:53:39 EDT
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 06:25:51 EDT
This is a dupe of bug 746190 (which is a closed bug, for whatever reason). In any case, its being addressed.
Comment 7 RHEL Product and Program Management 2012-05-03 01:17:18 EDT
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 03:50:04 EDT
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 04:05:53 EST
Clearing up leftover review flag

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