2012-05-29 54 views
0

我正在嘗試爲RHEL6構建perl-Heap-Priority。 Weired的事情是,當我運行 cpan2rpm Heap::Priority它顯示了在cpan2rpm cant stat/tmp文件夾

... 
Tarball extraction: [/root/rpm/SOURCES/Heap-Priority-0.01.tar.gz] 
Can't stat /tmp/CldQkErG6r/18:51: No such file or directory 
at /usr/bin/cpan2rpm line 392 
get_meta(): No such file or directory at /usr/bin/cpan2rpm line 396. 
... 

實際上這個臨時文件夾不會創建。買爲什麼? 我的TMP文件夾的權限是777

drwxrwxrwt. 3 root root 4096 May 29 16:35 tmp 

回答

1

已知問題,請參閱https://rt.cpan.org/Ticket/Display.html?id=72421。問題是輸出的用戶列的空間。

$ tar -tzvf $HOME/rpmbuild/SOURCES/Heap-Priority-0.01.tar.gz |head -1 
drwxr-xr-x James Freeman/544 0 2002-05-07 14:51 Heap-Priority-0.01/ 

應用以下補丁修復此模塊的問題。要獲取名稱,而不是訪問第五列,我們正在訪問最後一個。我不知道此修補程序可能會破壞什麼,但平均而言,它應該比原始代碼更少。

diff --git a/cpan2rpm b/cpan2rpm 
index 28e8b01..6a36b68 100755 
--- a/cpan2rpm 
+++ b/cpan2rpm 
@@ -1259,7 +1259,7 @@ sub untar($) { 
      ; 

     chomp($_ = qx/$cmd/); 
- $_ = (split)[5] unless $zip; 
+ $_ = (split)[-1] unless $zip; 
     $dst .= "/$1" if m|^(\S+)/?|; 
     $dst =~ s|/*$||; # path shouldn't end in/or tardir gets wiped 
     $dst =~ s|\./||; # paths in tarballs shouldn't be relative 

你可以通過using the debugger找到所有這些。學習使用這個工具,這是非常寶貴的。

0

我認爲這可能是做一個悅目更清潔的方式:

--- /usr/bin/cpan2rpm.orig 2017-10-20 14:45:57.000000000 -0700 
+++ /usr/bin/cpan2rpm 2017-10-23 12:29:07.006118950 -0700 
@@ -1258,7 +1258,7 @@ 

    my $cmd = $zip 
     ? "unzip -l $_ | grep -P -o '\\S+/\$' |tail -1" 
-  : "tar -t${z}vf $_ |head -1" 
+  : "tar --numeric-owner -t${z}vf $_ |head -1" 
     ; 

    chomp($_ = qx/$cmd/);