I'm trying to compile a C++ software a month ago.
There is a lot of pressure to make this work as soon as possible.
I've been looking for similar problems but I'm getting more and more confused.
I'm using the following:
bcmsa#braw176 ~/nba >uname -a
SunOS braw176 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-5_10
bcmsa#braw176 ~/nba >make -v
make -v
GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for sparc-sun-solaris2.8
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
Free Software Foundation, Inc.
I executed the command:
bcmsa#braw176 ~/nba/DLPRTER_CAA/bin/RPG3/default >make -dwp all
But I'm receiving the following:
Reaping winning child 0x0006da38 PID 27586
/bin/sh: /aps/APS40/RPG3_R4A/lib/cmtool/plugin/rpg3.R3B/tools/tools/scripts/sigunion.pl: not found
Live child 0x0006da38 (/export/home/bcmsa/nba/DLPRTER_CAA/bin/RPG3/default/sigunion.h) PID 27588
Got a SIGCHLD; 1 unreaped children.
Reaping losing child 0x0006da38 PID 27588
make: *** [/export/home/bcmsa/nba/DLPRTER_CAA/bin/RPG3/default/sigunion.h] Error 1
Removing child 0x0006da38 PID 27588 from chain.
The crazy thing is that sigunion.pl is stored at the indicated directory:
bcmsa#braw176 ~/nba >cd /aps/APS40/RPG3_R4A/lib/cmtool/plugin/rpg3.R3B/tools/tools/scripts/
bcmsa#braw176 /aps/APS40/RPG3_R4A/lib/cmtool/plugin/rpg3.R3B/tools/tools/scripts >ls -la
total 120
drwxrwsr-x 2 80422 3626 4096 Jun 12 2002 .
drwxrwsr-x 3 80422 3626 4096 Jun 12 2002 ..
-r-xr-xr-x 1 80422 3626 2195 Jun 28 1999 bdt_c.sh
-r-xr-xr-x 1 80422 3626 2449 Mar 8 1999 bdt_h.sh
-r-xr-xr-x 1 80422 3626 681 Oct 20 1999 change_base
-r-xr-xr-x 1 80422 3626 990 Oct 20 1999 convert_to_iog11
-r-xr-xr-x 1 80422 3626 692 Oct 20 1999 create_directory
-r-xr-xr-x 1 80422 3626 604 Oct 20 1999 create_elements
-r--r--r-- 1 80422 3626 582 Mar 2 1999 create_elements.base
-r-xr-xr-x 1 80422 3626 2059 Dec 13 2001 generate_signal_files.csh
-r-xr-xr-x 1 80422 3626 486 Oct 20 1999 generate_version_info
-r-xr-xr-x 1 80422 3626 610 Oct 20 1999 get_program.csh
-r-xr-xr-x 1 80422 3626 760 Oct 20 1999 get_suid.csh
-r-xr-xr-x 1 80422 3626 774 Oct 20 1999 set_autostart.pl
-r-xr-xr-x 1 80422 3626 1555 Oct 20 1999 sigunion.pl
Please, help me find how to fix this fault.
I really don't know what else to do.
I tried to execute the following just to see what happens:
bcmsa#braw176 /aps/APS40/RPG3_R4A/lib/cmtool/plugin/rpg3.R3B/tools/tools/scripts >perl sigunion.pl
Can't exec /usr/atria/bin/Perl at sigunion.pl line 1.
Info:
bcmsa#braw176 /aps/APS40/RPG3_R4A/lib/cmtool/plugin/rpg3.R3B/tools/tools/scripts >which perl
/usr/bin/perl
bcmsa#braw176 /aps/APS40/RPG3_R4A/lib/cmtool/plugin/rpg3.R3B/tools/tools/scripts >perl -v
This is perl, version 5.005_03 built for sun4-solaris
bcmsa#braw176 /aps/APS40/RPG3_R4A/lib/cmtool/plugin/rpg3.R3B/tools/tools/scripts >head sigunion.pl
#! /usr/atria/bin/Perl
I strongly suspect that the shebang in sigunion.pl (aka the #! line) is pointing to the wrong place for your perl executable.
head sigunion.pl will show you where sigunion.pl thinks perl is, and which perl will show you where perl is actually installed.
Example:
$ head sigunion.pl
#!/usr/bin/perl
.....stuff omited
$ which perl
/usr/opt/perl-5.8.8/bin/perl
/bin/sh: /aps/APS40/RPG3_R4A/lib/cmtool/plugin/rpg3.R3B/tools/tools/scripts/sigunion.pl: not found
...indicates that /bin/sh could not figure out how to run the script sigunion.pl. It is probably missing a shebang line:
#!/usr/bin/perl
...which tells the shell what external program (in this case, perl) to parse and run the file.
Alternatively, you can just let perl be found in the $PATH, by changing the appropriate line in the Makefile to:
perl /aps/APS40/RPG3_R4A/lib/cmtool/plugin/rpg3.R3B/tools/tools/scripts/sigunion.pl <arguments>
Related
I use the tar command a lot, very familiar with it. However, I tried creating an archive using the date command to name the archive file, and it throws an error to the effect that it can't open the file, which is strange because I'm not trying to open the file but create it.
Here's a copy of the directory, the code, and the error:
#MDG /media/VideoCam/Test $ ll
total 468
drwxr-xr-x 3 neo neo 4096 Sep 5 09:55 ./
drwxr-xr-x 4 neo neo 466944 Sep 4 21:54 ../
-rw-r--r-- 1 neo neo 45 Sep 5 08:52 1.jpg
-rw-rw-r-- 1 neo neo 0 Sep 5 08:41 1.mp4
-rw-r--r-- 1 neo neo 0 Sep 4 19:32 2.jpg
-rw-rw-r-- 1 neo neo 0 Sep 5 08:41 2.mp4
-rw-r--r-- 1 neo neo 0 Sep 4 19:32 3.jpg
-rw-r--r-- 1 neo neo 0 Sep 4 19:32 4.jpg
-rw-rw-r-- 1 neo neo 0 Sep 5 08:41 4.mp4
-rw-r--r-- 1 neo neo 0 Sep 4 19:32 5.jpg
-rw-rw-r-- 1 neo neo 0 Sep 5 08:41 5.mp4
-rw-r--r-- 1 neo neo 0 Sep 4 19:32 6.jpg
-rw-rw-r-- 1 neo neo 0 Sep 5 08:41 6.mp4
-rw-r--r-- 1 neo neo 0 Sep 4 19:32 7.jpg
-rw-rw-r-- 1 neo neo 0 Sep 5 08:41 7.mp4
-rw-r--r-- 1 neo neo 0 Sep 4 19:32 8.jpg
-rw-rw-r-- 1 neo neo 0 Sep 5 08:41 8.mp4
drwxr-xr-x 2 neo neo 4096 Sep 4 19:30 Archive/
neo#MDG /media/VideoCam/Test $ sudo tar -zcvf "archive.$(date '+%D').tar.gz" *.jpg
tar (child): archive.09/05/17.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
1.jpg
2.jpg
3.jpg
4.jpg
5.jpg
6.jpg
7.jpg
8.jpg
neo#MDG /media/VideoCam/Test $
I've tried many different concatenations, with and without quotes, switching up the order of the command options (zcvf), etc. If I leave out the date command and just give it a name, e.g. archive.tar.gz, it executes perfectly, but introducing the date command causes the error. I've also tried setting the date command as a variable with a similar result.
If you look at the error message, you see
tar (child): archive.09/05/17.tar.gz: Cannot open: No such file or directory
This indicates that it is trying to create the file archive.09/05/17.tar.gz. That is, 17.tar.gz in the directory 05, in the directory archive.09.
If this is what you actually want, which I doubt, you need to create the directory outside tar with something like
mkdir -p archive.09/05
If you don’t want subdirectories, you cannot use the / character in the filename. Try a different format for the date command; one common option is +%F because it generates filenames which would still be in the right order if sorted as text.
I strongly recommend you read the date man page and check the formatting options.
As it's been suggested by others the issue is with the format of date output
$ date '+%D'
09/05/17
You can't create a file with slashes in the name because of Unix typical behavior. You should instead try something like
$ date '+%m-%d-%Y'
09-05-2017
That in case you want to preserve the same formatting as %D.
The date is pritning out slashes and it's treating it as folder path. Use dashes.
As we know,the md5 of two different files(even if their contents are same) is different,just like this:
[langshiquan#cp01-rdqa-dev002.cp01.baidu.com md5test]$ ll
total 16
drwxrwxr-x 7 langshiquan langshiquan 4096 Mar 28 19:41 output
drwxrwxr-x 3 langshiquan langshiquan 4096 Mar 28 19:44 test
-rw-rw-r-- 1 langshiquan langshiquan 100 Mar 28 19:54 test.sh
-rw-rw-r-- 1 langshiquan langshiquan 69 Mar 28 19:48 test.sh~
[langshiquan#cp01-rdqa-dev002.cp01.baidu.com md5test]$ sh test.sh
[langshiquan#cp01-rdqa-dev002.cp01.baidu.com md5test]$ md5sum output.tar
2b7f05590cd4c8665dd61bbf745bbeee output.tar
[langshiquan#cp01-rdqa-dev002.cp01.baidu.com md5test]$ sh test.sh
[langshiquan#cp01-rdqa-dev002.cp01.baidu.com md5test]$ ll
total 18212
drwxrwxr-x 7 langshiquan langshiquan 4096 Mar 28 19:41 output
-rw-rw-r-- 1 langshiquan langshiquan 18606080 Mar 28 19:54 output.tar
drwxrwxr-x 3 langshiquan langshiquan 4096 Mar 28 19:44 test
-rw-rw-r-- 1 langshiquan langshiquan 100 Mar 28 19:54 test.sh
-rw-rw-r-- 1 langshiquan langshiquan 69 Mar 28 19:48 test.sh~
[langshiquan#cp01-rdqa-dev002.cp01.baidu.com md5test]$ md5sum output.tar
3601eff99bc78198b152b04ca94c53d0 output.tar
test.sh script shell :
#! bin/bash
cp -rp output ./test/
echo "1" > ./test/output/a.txt
tar -cf output.tar ./test/* -C ./
I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this.
Q1.So I think whether there is a hash function similar to MD5,(e.g.i call it just "HashStr") which makes the same "HashStr" for files with the same contents but different attributes.
Q2.Or when we can make TAR, how can we exclude the attributes of the file to make the same MD5?
Thanks in advance.
If the files are the same, then the hashes will be the same. If the attributes (rather than the file contents) are different, then you need to add the attributes to the file before hashing. Put the attributes you want to include into a piece of text and add it to the file. Then hash attributes + file as a single piece of data.
-rw-r--r-- 1 root root 3178 Jun 29 16:08 FTS_TESTCAMPAIGN1_29_06_2013_160823.html
-rw-r--r-- 1 root root 711 Jun 29 16:08 FTS_ABORT_BACKUP_JOB_1_29_06_2013_160823.html
-rw-r--r-- 1 root root 405 Jun 29 16:08 FTS_ABORT_BACKUP_JOB_1_29_06_2013_160823.csv
-rw-r--r-- 1 root root 466 Jun 29 16:08 FTS_ABORT_BACKUP_JOB_1_29_06_2013_160823
-rw-r--r-- 1 root root 3178 Jun 29 16:14 FTS_TESTCAMPAIGN1_29_06_2013_161404.html
-rw-r--r-- 1 root root 711 Jun 29 16:14 FTS_ABORT_BACKUP_JOB_1_29_06_2013_161404.html
-rw-r--r-- 1 root root 405 Jun 29 16:14 FTS_ABORT_BACKUP_JOB_1_29_06_2013_161404.csv
-rw-r--r-- 1 root root 466 Jun 29 16:14 FTS_ABORT_BACKUP_JOB_1_29_06_2013_161404
-rw-r--r-- 1 root root 0 Jun 29 16:25 log
I have the directory lising in a file as above. I need the output as:
FTS_TESTCAMPAIGN1_29_06_2013_160823.html
FTS_ABORT_BACKUP_JOB_1_29_06_2013_160823.html
FTS_ABORT_BACKUP_JOB_1_29_06_2013_160823.csv
FTS_ABORT_BACKUP_JOB_1_29_06_2013_160823
FTS_TESTCAMPAIGN1_29_06_2013_161404.html
FTS_ABORT_BACKUP_JOB_1_29_06_2013_161404.html
FTS_ABORT_BACKUP_JOB_1_29_06_2013_161404.csv
FTS_ABORT_BACKUP_JOB_1_29_06_2013_161404
log
How can I do it using Perl?
As long as the directory listing maintains the same structure, the following quick and dirty perl one-liner will do the job:
perl -pi.bak -ae 's/^.*$/$F[8]/' FILENAME
use File::Listing qw(parse_dir);
use File::Slurp qw(read_file);
print $_->[0], "\n" for parse_dir read_file 'ls-l';
perl -naE 'say $F[$#F]' file
That is, enable auto-split and print the last field on each line.
Analogously, in awk:
awk '{print $NF}' file
I have a file as shown below:
Sep 6 18:59 Cash_A2_updates_03_08_2011.sql
Sep 6 18:59 Cash_A2_updates_04_08_2011.sql
Sep 6 18:59 Cash_A2_updates_05_08_2011.sql
The first word in the file name nothing but the schema name. I want to keep it in a separate column and the rest of the file name in the last column as shown below.
Sep 6 18:59 Cash A2_updates_03_08_2011.sql
Sep 6 18:59 Cash A2_updates_04_08_2011.sql
Sep 6 18:59 Cash A2_updates_05_08_2011.sql
sed 's/_/ /'
Assuming that's always the first _ in there.
awk version: (if the file content is like what you shown us)
awk 'sub(/_/," ")' yourFile
test:
kent$ echo "Sep 6 18:59 Cash_A2_updates_03_08_2011.sql
Sep 6 18:59 Cash_A2_updates_04_08_2011.sql
Sep 6 18:59 Cash_A2_updates_05_08_2011.sql"|awk 'sub(/_/," ")'
output
Sep 6 18:59 Cash A2_updates_03_08_2011.sql
Sep 6 18:59 Cash A2_updates_04_08_2011.sql
Sep 6 18:59 Cash A2_updates_05_08_2011.sql
Are there any services similar to codepad that will allow you to test Perl constructs on old versions of perl?
Ideally, a system where you could enter an expression and it will tell you the oldest version of perl that it will work with.
Of course it's possible to use CPANTS for this, but that seems like an abuse of the service (if only for making the BackPan bigger). And it could take several days/weeks to get decent test coverage on old versions.
You might find Perl::MinimumVersion helpful. Use the provided perlver utility to scan your code.
I think that if I was concerned, I'd build salient versions of Perl on my machine and test them. Actually, that's more or less what I do anyway. My Solaris 10 machine has:
lrwxrwxrwx 1 jleffler rd 26 Mar 6 2008 v5.10.0 -> v5.10.0-32bit-multiplicity
drwxr-xr-x 3 jleffler rd 512 Jan 10 2008 v5.10.0-32bit
drwxr-xr-x 6 jleffler rd 512 Mar 7 2008 v5.10.0-32bit-multiplicity
drwxr-xr-x 3 jleffler rd 512 Jan 10 2008 v5.10.0-64bit
lrwxrwxrwx 1 jleffler rd 13 Jan 29 21:07 v5.10.1 -> v5.10.1-64bit
drwxr-xr-x 6 jleffler rd 512 Jan 29 21:43 v5.10.1-64bit
drwxr-xr-x 5 jleffler rd 512 May 6 2003 v5.5.3
lrwxrwxrwx 1 jleffler RAND 11 Mar 21 2007 v5.6.1 -> v5.6.1-full
drwxr-xr-x 5 jleffler rd 512 May 6 2003 v5.6.1-full
drwxr-xr-x 5 jleffler rd 512 Feb 5 2008 v5.8.7-multi
lrwxrwxrwx 1 jleffler rd 19 Mar 24 2007 v5.8.8 -> v5.8.8-32bit-sun-cc
drwxr-xr-x 6 jleffler rd 512 Mar 25 2007 v5.8.8-32bit-sun-cc
drwxr-xr-x 5 jleffler rd 512 Feb 13 2006 v5.8.8-64bit-thread-multi
drwxr-xr-x 3 jleffler rd 512 Mar 20 2008 v5.8.8-gcc-3.4.6
So, that's 5.5.3, 5.6.1, 5.8.7, 5.8.8, 5.10.0 and 5.10.1 installed; I have the source for other versions too:
-rw-r--r-- 1 jleffler rd 2171936 Apr 12 2001 perl-5.004_04.tar.bz2
-rw-r--r-- 1 jleffler rd 3023320 Aug 31 1999 perl-5.005_03.tar.bz2
-rw-r--r-- 1 jleffler rd 12426022 Dec 18 2007 perl-5.10.0.tar.bz2
-rw-r--r-- 1 jleffler rd 11608061 Jan 29 12:32 perl-5.10.1.tar.bz2
-rw-r--r-- 1 jleffler rd 4430438 Mar 29 2000 perl-5.6.0.tar.bz2
-rw-r--r-- 1 jleffler rd 4864306 Apr 8 2001 perl-5.6.1.tar.bz2
-rw-r--r-- 1 jleffler rd 5142605 Aug 16 2005 perl-5.6.2.tar.bz2
-rw-r--r-- 1 jleffler rd 8618487 Jul 18 2002 perl-5.8.0.tar.bz2
-rw------- 1 jleffler rd 9410641 Sep 29 2003 perl-5.8.1.tar.bz2
-rw-r--r-- 1 jleffler rd 9424944 Nov 5 2003 perl-5.8.2.tar.bz2
-rw-r--r-- 1 jleffler rd 9509716 Jan 14 2004 perl-5.8.3.tar.bz2
-rw-r--r-- 1 jleffler rd 9598489 Apr 21 2004 perl-5.8.4.tar.bz2
-rw-r--r-- 1 jleffler rd 9464689 Jul 19 2004 perl-5.8.5.tar.bz2
-rw-r--r-- 1 jleffler rd 9693085 Nov 27 2004 perl-5.8.6.tar.bz2
-rw-r--r-- 1 jleffler rd 9839086 Jun 15 2005 perl-5.8.7.tar.bz2
-rw-r--r-- 1 jleffler rd 10123359 Feb 13 2006 perl-5.8.8.tar.bz2
-rw-r--r-- 1 jleffler rd 11121414 Dec 14 2008 perl-5.8.9.tar.bz2
#Ether asked:
Do you have a script which will run a particular module, script or unit test against all versions in sequence and collate the results? Such a utility might be really handy as a chrooted/sandboxed CGI.
No, but I haven't needed it. It's basically trivially, though:
for perl in /usr/perl/v5.*.?
do
echo $(basename $perl)
$perl/bin/perl "$#"
done
Basically, for each of the Perl directories in /usr/perl/, run the perl from the bin directory on the given set of arguments. Watch the output...
The difficulty is in deciding what constitutes pass/fail. Obviously, the core of the loop could be:
if $perl/bin/perl "$#" >/dev/null 2>&1
then echo ok $perl
else echo not ok $perl
fi
That's faintly similar to the TAP output. To make it formally equivalent (using bash or Korn shell):
test=0
max=$(ls -d /usr/perl/v5.*.? | wc -l | sed 's/ //g')
echo 1..$max
for perl in /usr/perl/v5.*.?
do
((test = test + 1))
if $perl/bin/perl "$#" >/dev/null 2>&1
then echo ok $test - $perl
else echo not ok $test - $perl
fi
done
Here's an example of running it:
$ ksh test.perl -e 'exit 0'
1..6
ok 1 - /usr/perl/v5.10.0
ok 2 - /usr/perl/v5.10.1
ok 3 - /usr/perl/v5.5.3
ok 4 - /usr/perl/v5.6.1
ok 5 - /usr/perl/v5.8.8
not ok 6 - /usr/perl/v5.8.8-gcc-3.4.6
$
That shows a limitation in shell scripts and their globbing facilities (I'd like to limit the 'star' to a series of digits). The Perl that fails does so because the bin directory doesn't contain a copy of Perl; I needed to save space at some point! It would not be hard to convert the shell script into a Perl script, of course.
If you're looking for when a module was introduced to core Perl, you can use Module::CoreList.
If you'd like to help develop a system like codepad for Perl, search for "PITA testing".
Specifically, if you want a utility to download and install a number of Perl binaries to test your code, you can look at the programs in PITA-Setup-Perl/bin.
I know perlcritic is capable of finding a few cases, but in general you will have to look it up in google or in perldelta files. In particular, you may want to look at the deltas for 5.6 5.8 and 5.10 and maybe even the upcoming 5.12