Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 577219 Details for
Bug 811363
lua rpm scripts do not properly restore path after running
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
lua script chroot v1.1
rpm-4.8.0-lua-chroot.patch (text/plain), 1.86 KB, created by
Chris Seawood
on 2012-04-13 03:53:39 UTC
(
hide
)
Description:
lua script chroot v1.1
Filename:
MIME Type:
Creator:
Chris Seawood
Created:
2012-04-13 03:53:39 UTC
Size:
1.86 KB
patch
obsolete
>diff -up rpm-4.8.0/lib/psm.c.lua-chroot rpm-4.8.0/lib/psm.c >--- rpm-4.8.0/lib/psm.c.lua-chroot 2012-04-12 16:14:27.343163957 -0700 >+++ rpm-4.8.0/lib/psm.c 2012-04-12 17:12:13.379020257 -0700 >@@ -454,25 +454,31 @@ static rpmRC runLuaScript(rpmpsm psm, He > const rpmts ts = psm->ts; > #ifdef WITH_LUA > char *sname = NULL; >- int rootFd = -1; > int xx; > rpmlua lua = NULL; /* Global state. */ > rpmluav var; > mode_t oldmask; >+ int useChroot = 0; >+ char currentPath[PATH_MAX]; >+ const char *rootDir = rpmtsRootDir(ts); > > rasprintf(&sname, "%s(%s)", tag2sln(stag), rpmteNEVRA(psm->te)); > > rpmlog(RPMLOG_DEBUG, "%s: %s running <lua> scriptlet.\n", > psm->stepName, sname); >+ >+ memset(currentPath, 0, PATH_MAX); >+ (void)getcwd(currentPath, PATH_MAX); >+ >+ if (rootDir != NULL && !rstreq(rootDir, "/") && >+ !(rootDir[0] == '/' && rootDir[1] == '\0')) { >+ useChroot = 1; >+ } > if (!rpmtsChrootDone(ts)) { >- const char *rootDir = rpmtsRootDir(ts); >- xx = chdir("/"); >- rootFd = open(".", O_RDONLY, 0); >- if (rootFd >= 0) { >- if (rootDir != NULL && !rstreq(rootDir, "/") && *rootDir == '/') >- xx = chroot(rootDir); >- xx = rpmtsSetChrootDone(ts, 1); >- } >+ if (useChroot) >+ xx = chroot(rootDir); >+ xx = chdir("/"); >+ xx = rpmtsSetChrootDone(ts, 1); > } > > /* Create arg variable */ >@@ -510,12 +516,11 @@ static rpmRC runLuaScript(rpmpsm psm, He > > rpmluaDelVar(lua, "arg"); > >- if (rootFd >= 0) { >- const char *rootDir = rpmtsRootDir(ts); >- xx = fchdir(rootFd); >- xx = close(rootFd); >- if (rootDir != NULL && !rstreq(rootDir, "/") && *rootDir == '/') >- xx = chroot("."); >+ if (rpmtsChrootDone(ts)) { >+ if (useChroot) >+ xx = chroot("."); >+ if (*currentPath) >+ xx = chdir(currentPath); > xx = rpmtsSetChrootDone(ts, 0); > } > free(sname);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 811363
:
576575
|
576576
|
576577
| 577219