Skip Menu |

This queue is for tickets about the RPM-Tools CPAN distribution.

Report information
The Basics
Id: 1594
Status: open
Worked: 40 min
Priority: 0/
Queue: RPM-Tools

People
Owner: Nobody in particular
Requestors: tjmather [...] tjmather.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.6
Fixed in: (no value)



Subject: Removed prune from find to make it work on Linux
RPM-Tools-0.6 Perl 5.6.1 Linux 2.4.2 GNU find 4.1.6 make test failed on Linux with the following message: [tjmather@br1a RPM-Tools-0.6]$ make test PERL_DL_NONLAZY=1 /usr/longitude/bin/perl -Iblib/arch -Iblib/lib -I/usr/longitude/lib/perl5/5.6.1/i386-linux -I/usr/longitude/lib/perl5/5.6.1 test.pl This script will try to build an RPM assuming an i386 architecture. Generating temporary directory ./TempBuildLoc Creating stand-alone rpm build environment. **** ERROR **** tmproot/file1.txt is neither a directory, soft link, or file. make: *** [test_dynamic] Error 29 I was able to fix the problem by removing -prune from the find command. On my system find doesn't return the file if -prune is included. I have included a patch that removes -prune from the find. I'm not sure if this change is compatible with other Operating systems.
diff -ru RPM-Tools-0.6/RPM/Make.pm RPM-Tools-0.61/RPM/Make.pm --- RPM-Tools-0.6/RPM/Make.pm Wed Sep 11 12:23:34 2002 +++ RPM-Tools-0.61/RPM/Make.pm Wed Sep 18 15:27:12 2002 @@ -617,16 +617,16 @@ sub find_info { my ($file)=@_; my $line=''; - if (($line=`find $file -type f -prune`)=~/^$file\n/) { - $line=`find $file -type f -prune -printf "\%s\t\%m\t\%u\t\%g"`; + if (($line=`find $file -type f`)=~/^$file\n/) { + $line=`find $file -type f -printf "\%s\t\%m\t\%u\t\%g"`; return("files",split(/\t/,$line)); } - elsif (($line=`find $file -type d -prune`)=~/^$file\n/) { - $line=`find $file -type d -prune -printf "\%s\t\%m\t\%u\t\%g"`; + elsif (($line=`find $file -type d`)=~/^$file\n/) { + $line=`find $file -type d -printf "\%s\t\%m\t\%u\t\%g"`; return("directories",split(/\t/,$line)); } - elsif (($line=`find $file -type l -prune`)=~/^$file\n/) { - $line=`find $file -type l -prune -printf "\%l\t\%m\t\%u\t\%g"`; + elsif (($line=`find $file -type l`)=~/^$file\n/) { + $line=`find $file -type l -printf "\%l\t\%m\t\%u\t\%g"`; return("links",split(/\t/,$line)); } die("**** ERROR **** $file is neither a directory, soft link, or file.\n");
The prune argument to the find command is necessary to avoid multiple value output for something like: find tmproot -type d -printf "%s\t%m\t%u\t%g\n" Your patch would have the multiple value output problem for the above. For a work-around (to retain backwards compatibility with GNU find < 4.1.7), it is not adequate to simply remove the "prune" argument. I suggest that one must substitute "-maxdepth 0" instead: find tmproot -type d -maxdepth 0 -printf "%s\t%m\t%u\t%g\n" I will commit this maxdepth patch unless you have other ideas. An even-better solution might be to just use the File::Find module...(however I am trying to make the module lightweight and avoid external CPAN dependencies). Note that RPM::Make (from RPM-Tools) is supposed to reliably work on Linux perhaps more than any other UN*X flavor. It does work on RH6.* and RH7.*. So, out of curiosity, and to support OS-version-centric users, I would like to ask what Linux flavor/version you were trying to use this module on. [guest - Tue Oct 1 17:35:16 2002]: Show quoted text
> RPM-Tools-0.6 > Perl 5.6.1 > Linux 2.4.2 > GNU find 4.1.6 > > make test failed on Linux with the following message: > [tjmather@br1a RPM-Tools-0.6]$ make test > PERL_DL_NONLAZY=1 /usr/longitude/bin/perl -Iblib/arch -Iblib/lib > -I/usr/longitude/lib/perl5/5.6.1/i386-linux > -I/usr/longitude/lib/perl5/5.6.1 test.pl > This script will try to build an RPM assuming an i386 architecture. > Generating temporary directory ./TempBuildLoc > Creating stand-alone rpm build environment. > **** ERROR **** tmproot/file1.txt is neither a directory, soft link, > or file. > make: *** [test_dynamic] Error 29 > > I was able to fix the problem by removing -prune from the find > command. On my system > find doesn't return the file if -prune is included. I have included a > patch that removes > -prune from the find. I'm not sure if this change is compatible with > other Operating > systems.
The prune argument to the find command is necessary to avoid multiple value output for something like: find tmproot -type d -printf "%s\t%m\t%u\t%g\n" Your patch would have the multiple value output problem for the above. For a work-around (to retain backwards compatibility with GNU find < 4.1.7), it is not adequate to simply remove the "prune" argument. I suggest that one must substitute "-maxdepth 0" instead: find tmproot -type d -maxdepth 0 -printf "%s\t%m\t%u\t%g\n" I will commit this maxdepth patch unless you have other ideas. An even-better solution might be to just use the File::Find module...(however I am trying to make the module lightweight and avoid external CPAN dependencies). Note that RPM::Make (from RPM-Tools) is supposed to reliably work on Linux perhaps more than any other UN*X flavor. It does work on RH6.* and RH7.*. So, out of curiosity, and to support OS-version-centric users, I would like to ask what Linux flavor/version you were trying to use this module on. [guest - Tue Oct 1 17:35:16 2002]: Show quoted text
> RPM-Tools-0.6 > Perl 5.6.1 > Linux 2.4.2 > GNU find 4.1.6 > > make test failed on Linux with the following message: > [tjmather@br1a RPM-Tools-0.6]$ make test > PERL_DL_NONLAZY=1 /usr/longitude/bin/perl -Iblib/arch -Iblib/lib > -I/usr/longitude/lib/perl5/5.6.1/i386-linux > -I/usr/longitude/lib/perl5/5.6.1 test.pl > This script will try to build an RPM assuming an i386 architecture. > Generating temporary directory ./TempBuildLoc > Creating stand-alone rpm build environment. > **** ERROR **** tmproot/file1.txt is neither a directory, soft link, > or file. > make: *** [test_dynamic] Error 29 > > I was able to fix the problem by removing -prune from the find > command. On my system > find doesn't return the file if -prune is included. I have included a > patch that removes > -prune from the find. I'm not sure if this change is compatible with > other Operating > systems.
The prune argument to the find command is necessary to avoid multiple value output for something like: find tmproot -type d -printf "%s\t%m\t%u\t%g\n" Your patch would have the multiple value output problem for the above. For a work-around (to retain backwards compatibility with GNU find < 4.1.7), it is not adequate to simply remove the "prune" argument. I suggest that one must substitute "-maxdepth 0" instead: find tmproot -type d -maxdepth 0 -printf "%s\t%m\t%u\t%g\n" I will commit this maxdepth patch unless you have other ideas. An even-better solution might be to just use the File::Find module...(however I am trying to make the module lightweight and avoid external CPAN dependencies). Note that RPM::Make (from RPM-Tools) is supposed to reliably work on Linux perhaps more than any other UN*X flavor. It does work on RH6.* and RH7.*. So, out of curiosity, and to support OS-version-centric users, I would like to ask what Linux flavor/version you were trying to use this module on. [guest - Tue Oct 1 17:35:16 2002]: Show quoted text
> RPM-Tools-0.6 > Perl 5.6.1 > Linux 2.4.2 > GNU find 4.1.6 > > make test failed on Linux with the following message: > [tjmather@br1a RPM-Tools-0.6]$ make test > PERL_DL_NONLAZY=1 /usr/longitude/bin/perl -Iblib/arch -Iblib/lib > -I/usr/longitude/lib/perl5/5.6.1/i386-linux > -I/usr/longitude/lib/perl5/5.6.1 test.pl > This script will try to build an RPM assuming an i386 architecture. > Generating temporary directory ./TempBuildLoc > Creating stand-alone rpm build environment. > **** ERROR **** tmproot/file1.txt is neither a directory, soft link, > or file. > make: *** [test_dynamic] Error 29 > > I was able to fix the problem by removing -prune from the find > command. On my system > find doesn't return the file if -prune is included. I have included a > patch that removes > -prune from the find. I'm not sure if this change is compatible with > other Operating > systems.
From: tjmather [...] tjmather.com
I tried replacing -prune with -maxdepth 0 and it works great. Feel free to commit the patch, sounds like the best way to fix the problem and retain backwards compatibility. Thanks! I'm running RedHat Linux 7.1 [SHARRISON - Wed Oct 2 11:09:47 2002]: Show quoted text
> must substitute "-maxdepth 0" instead: > find tmproot -type d -maxdepth 0 -printf > "%s\t%m\t%u\t%g\n" > > I will commit this maxdepth patch unless you have other ideas. An
Show quoted text
> So, out of curiosity, and to support OS-version-centric > users, > I would like to ask what Linux flavor/version you were trying to use > this > module on.