Bug 58142 - directory name of /.../ in package_spec path gets mangled doing rpm -bb
Summary: directory name of /.../ in package_spec path gets mangled doing rpm -bb
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm-build
Version: 7.2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-01-09 21:08 UTC by brian horton
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-01-17 19:49:55 UTC
Embargoed:


Attachments (Terms of Use)
output of 'strace -o rpm_strace -f rpm -bb -vv /.../pcd.spec' on gold RedHat 7.2 system. (29.34 KB, text/plain)
2002-01-09 21:12 UTC, brian horton
no flags Details

Description brian horton 2002-01-09 21:08:00 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.78 [en] (WinNT; U)

Description of problem:
if the package_spec file passed into rpm has /.../ in the directory, something inside rpm drops one of the '.':

[root]# rpm -bb -vv /.../pcd.spec 
error: Unable to open /../pcd.spec: No such file or directory
error: Name field must be present in package: (main package)
error: Version field must be present in package: (main package)
error: Release field must be present in package: (main package)
error: Summary field must be present in package: (main package)
error: Group field must be present in package: (main package)
error: License field must be present in package: (main package)
[root]# ls -l /.../pcd.spec 
-rw-r--r--    1 root     root         3771 Jan  9 15:33 /.../pcd.spec

my pcd.spec file also has a /.../whatever directory listed as BuildRoot

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


How reproducible:
Always

Steps to Reproduce:
1. have spec file in /.../ directory
2. execute rpm -bb -vv /.../your_spec_file

	

Actual Results:  first line of output:

/../whatever.spec: No such file or directory


Expected Results:  it should have found the /.../whatever.spec file

Additional info:

works ok w/ RPM that ships with RedHat 6.2; fails on 6.2 with 4.0.2-6x and on 7.2 with 4.0.3-1.03

strace shows rpmb getting called ok:
execve("/usr/lib/rpm/rpmb", ["/usr/lib/rpm/rpmb", "-bb", "--verbose", "--verbose", "--", "/.../pcd.spec"], [/* 26 vars */]) = 0

and it opened afterward:

open("/etc/rpm/macros", O_RDONLY)       = -1 ENOENT (No such file or directory)
open("/etc/rpm/i686-linux/macros", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/root/.rpmmacros", O_RDONLY)      = -1 ENOENT (No such file or directory)
stat("/.../pcd.spec", {st_mode=S_IFREG|0644, st_size=3771, ...}) = 0
open("/.../pcd.spec", O_RDONLY)         = 4

but the next open fails:

brk(0x8063000)                          = 0x8063000
brk(0x8066000)                          = 0x8066000
open("/../pcd.spec", O_RDONLY)          = -1 ENOENT (No such file or directory)

Comment 1 brian horton 2002-01-09 21:12:02 UTC
Created attachment 42131 [details]
output of 'strace -o rpm_strace -f rpm -bb -vv /.../pcd.spec' on gold RedHat 7.2 system.

Comment 2 Jeff Johnson 2002-01-09 21:15:47 UTC
Yes, rpm cleans all it's file paths.

Why do you care whether rpm handles /.../?

Comment 3 brian horton 2002-01-09 21:32:45 UTC
DFS 'mounts' onto /.../ which is where I'm hitting this. Yes, DFS is not supported on Linux, but there is a DFS-NFS mapper that allows you to mount a 
dfs directories via nfs. (DFS is a new/improved/different AFS.)

So, rpm is not cleanning properly. What is rpm expecting /.../ to mean? 

thx.bri.

Comment 4 Jeff Johnson 2002-01-09 21:49:23 UTC
Try hacking on rpmCleanPath() in rpmio/macro.c, that's where
the dirty is done. If you get something that works, please send me a
patch.

Comment 5 Christopher Kime 2002-01-17 19:49:50 UTC
A small change to rpmCleanPath() in rpmio/macro.c seemed to do the trick:
[root@pdoslinux rpmio]# diff macro.c macro.c.fix
1624c1624,1629
< 	    if (begin && s[1] == '.') {
---
> 	    /* Check that it is ../, so that we don't interpret	*/
> 	    /* ..?(i.e. "...") or ..* (i.e. "..bogus") as "..". */
> 	    /* in the case of "...", this ends up being processed*/
> 	    /* as "../.", and the last '.' is stripped.  This 	*/
> 	    /* would not be correct processing.			*/
> 	    if (begin && s[1] == '.' && (s[2] == '/' || s[2] == '\0')) {


Comment 6 Jeff Johnson 2002-01-27 14:13:00 UTC
Got it, thanks for the patch. Should be in rpm-4.0.4-0.21 and
later.


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