dpkg-source.pl 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071
  1. #! /usr/bin/perl
  2. my $dpkglibdir = ".";
  3. my $version = "1.3.0"; # This line modified by Makefile
  4. my @filesinarchive;
  5. my %dirincluded;
  6. my %notfileobject;
  7. my $fn;
  8. $diff_ignore_default_regexp = '^.*~$|^\..*\.swp|DEADJOE|(?:/CVS|/RCS|/.deps)(?:$|/.*$)';
  9. $sourcestyle = 'X';
  10. $dscformat = "1.0";
  11. use POSIX;
  12. use POSIX qw (:errno_h :signal_h);
  13. use strict 'refs';
  14. push (@INC, $dpkglibdir);
  15. require 'controllib.pl';
  16. # Make sure patch doesn't get any funny ideas
  17. delete $ENV{'POSIXLY_CORRECT'};
  18. sub usageversion {
  19. print STDERR
  20. "Debian dpkg-source $version. Copyright (C) 1996
  21. Ian Jackson and Klee Dienes. This is free software; see the GNU
  22. General Public Licence version 2 or later for copying conditions.
  23. There is NO warranty.
  24. Usage: dpkg-source -x <filename>.dsc
  25. dpkg-source -b <directory> [<orig-directory>|<orig-targz>|\'\']
  26. Build options: -c<controlfile> get control info from this file
  27. -l<changelogfile> get per-version info from this file
  28. -F<changelogformat> force change log format
  29. -V<name>=<value> set a substitution variable
  30. -T<varlistfile> read variables here, not debian/substvars
  31. -D<field>=<value> override or add a .dsc field and value
  32. -U<field> remove a field
  33. -sa auto select orig source (-sA is default)
  34. -i[<regexp>] filter out files to ignore diffs of.
  35. Defaults to: '$diff_ignore_default_regexp'
  36. -sk use packed orig source (unpack & keep)
  37. -sp use packed orig source (unpack & remove)
  38. -su use unpacked orig source (pack & keep)
  39. -sr use unpacked orig source (pack & remove)
  40. -ss trust packed & unpacked orig src are same
  41. -sn there is no diff, do main tarfile only
  42. -sA,-sK,-sP,-sU,-sR like -sa,-sp,-sk,-su,-sr but may overwrite
  43. Extract options: -sp (default) leave orig source packed in current dir
  44. -sn do not copy original source to current dir
  45. -su unpack original source tree too
  46. General options: -h print this message
  47. ";
  48. }
  49. $i = 100;
  50. grep ($fieldimps {$_} = $i--,
  51. qw (Format Source Version Binary Origin Maintainer Architecture
  52. Standards-Version Build-Depends Build-Depends-Indep Build-Conflicts
  53. Build-Conflicts-Indep));
  54. while (@ARGV && $ARGV[0] =~ m/^-/) {
  55. $_=shift(@ARGV);
  56. if (m/^-b$/) {
  57. &setopmode('build');
  58. } elsif (m/^-x$/) {
  59. &setopmode('extract');
  60. } elsif (m/^-s([akpursnAKPUR])$/) {
  61. $sourcestyle= $1;
  62. } elsif (m/^-c/) {
  63. $controlfile= $';
  64. } elsif (m/^-l/) {
  65. $changelogfile= $';
  66. } elsif (m/^-F([0-9a-z]+)$/) {
  67. $changelogformat=$1;
  68. } elsif (m/^-D([^\=:]+)[=:]/) {
  69. $override{$1}= $';
  70. } elsif (m/^-U([^\=:]+)$/) {
  71. $remove{$1}= 1;
  72. } elsif (m/^-i(.*)$/) {
  73. $diff_ignore_regexp = $1 ? $1 : $diff_ignore_default_regexp;
  74. } elsif (m/^-V(\w[-:0-9A-Za-z]*)[=:]/) {
  75. $substvar{$1}= $';
  76. } elsif (m/^-T/) {
  77. $varlistfile= $';
  78. } elsif (m/^-h$/) {
  79. &usageversion; exit(0);
  80. } elsif (m/^--$/) {
  81. last;
  82. } else {
  83. &usageerr("unknown option $_");
  84. }
  85. }
  86. defined($opmode) || &usageerr("need -x or -b");
  87. $SIG{'PIPE'} = 'DEFAULT';
  88. if ($opmode eq 'build') {
  89. $sourcestyle =~ y/X/A/;
  90. $sourcestyle =~ m/[akpursnAKPUR]/ ||
  91. &usageerr("source handling style -s$sourcestyle not allowed with -b");
  92. @ARGV || &usageerr("-b needs a directory");
  93. @ARGV<=2 || &usageerr("-b takes at most a directory and an orig source argument");
  94. $dir= shift(@ARGV);
  95. $dir= "./$dir" unless $dir =~ m:^/:; $dir =~ s,/*$,,;
  96. stat($dir) || &error("cannot stat directory $dir: $!");
  97. -d $dir || &error("directory argument $dir is not a directory");
  98. $changelogfile= "$dir/debian/changelog" unless defined($changelogfile);
  99. $controlfile= "$dir/debian/control" unless defined($controlfile);
  100. &parsechangelog;
  101. &parsecontrolfile;
  102. $f{"Format"}=$dscformat;
  103. $archspecific=0;
  104. for $_ (keys %fi) {
  105. $v= $fi{$_};
  106. if (s/^C //) {
  107. #print STDERR "G key >$_< value >$v<\n";
  108. if (m/^Source$/) { &setsourcepackage; }
  109. elsif (m/^(Standards-Version|Origin|Maintainer)$/) { $f{$_}= $v; }
  110. elsif (m/^Build-(Depends|Conflicts)(-Indep)?$/i) { $f{$_}= $v; }
  111. elsif (s/^X[BC]*S[BC]*-//i) { $f{$_}= $v; }
  112. elsif (m/^(Section|Priority|Files|Bugs)$/ || m/^X[BC]+-/i) { }
  113. else { &unknown('general section of control info file'); }
  114. } elsif (s/^C(\d+) //) {
  115. #print STDERR "P key >$_< value >$v<\n";
  116. $i=$1; $p=$fi{"C$i Package"};
  117. push(@binarypackages,$p) unless $packageadded{$p}++;
  118. if (m/^Architecture$/) {
  119. #print STDERR "$p >$v< >".join(' ',@sourcearch)."<\n";
  120. if ($v eq 'any') {
  121. @sourcearch= ('any');
  122. } elsif ($v eq 'all') {
  123. if (!@sourcearch || $sourcearch[0] eq 'all') {
  124. @sourcearch= ('all');
  125. } else {
  126. @sourcearch= ('any');
  127. }
  128. } else {
  129. for $a (split(/\s+/,$v)) {
  130. &error("architecture $a only allowed on its own".
  131. " (list for package $p is \`$a')")
  132. if grep($a eq $_, 'any','all');
  133. push(@sourcearch,$a) unless $archadded{$a}++;
  134. }
  135. }
  136. $f{'Architecture'}= join(' ',@sourcearch);
  137. } elsif (s/^X[BC]*S[BC]*-//i) {
  138. $f{$_}= $v;
  139. } elsif (m/^(Package|Essential|Pre-Depends|Depends|Provides)$/ ||
  140. m/^(Recommends|Suggests|Optional|Conflicts|Replaces)$/ ||
  141. m/^(Description|Section|Priority)$/ ||
  142. m/^X[CS]+-/i) {
  143. } else {
  144. &unknown("package's section of control info file");
  145. }
  146. } elsif (s/^L //) {
  147. #print STDERR "L key >$_< value >$v<\n";
  148. if (m/^Source$/) {
  149. &setsourcepackage;
  150. } elsif (m/^Version$/) {
  151. $f{$_}= $v;
  152. } elsif (s/^X[BS]*C[BS]*-//i) {
  153. $f{$_}= $v;
  154. } elsif (m/^(Maintainer|Changes|Urgency|Distribution|Date|Closes)$/ ||
  155. m/^X[BS]+-/i) {
  156. } else {
  157. &unknown("parsed version of changelog");
  158. }
  159. } else {
  160. &internerr("value from nowhere, with key >$_< and value >$v<");
  161. }
  162. }
  163. $f{'Binary'}= join(', ',@binarypackages);
  164. for $f (keys %override) { $f{&capit($f)}= $override{$f}; }
  165. for $f (qw(Version)) {
  166. defined($f{$f}) || &error("missing information for critical output field $f");
  167. }
  168. for $f (qw(Maintainer Architecture Standards-Version)) {
  169. defined($f{$f}) || &warn("missing information for output field $f");
  170. }
  171. defined($sourcepackage) || &error("unable to determine source package name !");
  172. $f{'Source'}= $sourcepackage;
  173. for $f (keys %remove) { delete $f{&capit($f)}; }
  174. $version= $f{'Version'};
  175. $version =~ s/^\d+://; $upstreamversion= $version; $upstreamversion =~ s/-[^-]*$//;
  176. $basenamerev= $sourcepackage.'_'.$version;
  177. $basename= $sourcepackage.'_'.$upstreamversion;
  178. $basedirname= $basename;
  179. #print STDERR ">$basedirname<\n";
  180. $basedirname =~ s/_/-/;
  181. #print STDERR ">$basedirname<\n";
  182. $origdir= "$dir.orig";
  183. $origtargz= "$basename.orig.tar.gz";
  184. if (@ARGV) {
  185. $origarg= shift(@ARGV);
  186. if (length($origarg)) {
  187. stat($origarg) || &error("cannot stat orig argument $origarg: $!");
  188. if (-d _) {
  189. $origdir= $origarg;
  190. $origdir= "./$origdir" unless $origdir =~ m,^/,; $origdir =~ s,/*$,,;
  191. $sourcestyle =~ y/aA/rR/;
  192. $sourcestyle =~ m/[ursURS]/ ||
  193. &error("orig argument is unpacked but source handling style".
  194. " -s$sourcestyle calls for packed (.orig.tar.gz)");
  195. } elsif (-f _) {
  196. $origtargz= $origarg;
  197. $sourcestyle =~ y/aA/pP/;
  198. $sourcestyle =~ m/[kpsKPS]/ ||
  199. &error("orig argument is packed but source handling style".
  200. " -s$sourcestyle calls for unpacked (.orig/)");
  201. } else {
  202. &error("orig argument $origarg is not a plain file or directory");
  203. }
  204. } else {
  205. $sourcestyle =~ y/aA/nn/;
  206. $sourcestyle =~ m/n/ ||
  207. &error("orig argument is empty (means no orig, no diff)".
  208. " but source handling style -s$sourcestyle wants something");
  209. }
  210. }
  211. if ($sourcestyle =~ m/[aA]/) {
  212. if (stat("$origtargz")) {
  213. -f _ || &error("packed orig \`$origtargz' exists but is not a plain file");
  214. $sourcestyle =~ y/aA/pP/;
  215. } elsif ($! != ENOENT) {
  216. &syserr("unable to stat putative packed orig \`$origtargz'");
  217. } elsif (stat("$origdir")) {
  218. -d _ || &error("unpacked orig \`$origdir' exists but is not a directory");
  219. $sourcestyle =~ y/aA/rR/;
  220. } elsif ($! != ENOENT) {
  221. &syserr("unable to stat putative unpacked orig \`$origdir'");
  222. } else {
  223. $sourcestyle =~ y/aA/nn/;
  224. }
  225. }
  226. $dirbase= $dir; $dirbase =~ s,/?$,,; $dirbase =~ s,[^/]+$,,; $dirname= $&;
  227. $dirname eq $basedirname || &warn("source directory \`$dir' is not <sourcepackage>".
  228. "-<upstreamversion> \`$basedirname'");
  229. if ($sourcestyle ne 'n') {
  230. $origdirbase= $origdir; $origdirbase =~ s,/?$,,;
  231. $origdirbase =~ s,[^/]+$,,; $origdirname= $&;
  232. $origdirname eq "$basedirname.orig" ||
  233. &warn(".orig directory name $origdirname is not <package>".
  234. "-<upstreamversion> (wanted $basedirname.orig)");
  235. $tardirbase= $origdirbase; $tardirname= $origdirname;
  236. $tarname= $origtargz;
  237. $tarname eq "$basename.orig.tar.gz" ||
  238. &warn(".orig.tar.gz name $tarname is not <package>_<upstreamversion>".
  239. ".orig.tar.gz (wanted $basename.orig.tar.gz)");
  240. } else {
  241. $tardirbase= $dirbase; $tardirname= $dirname;
  242. $tarname= "$basenamerev.tar.gz";
  243. }
  244. #print STDERR ">$dir|$origdir|$origtargz|$sourcestyle<\n";
  245. if ($sourcestyle =~ m/[nurUR]/) {
  246. if (stat($tarname)) {
  247. $sourcestyle =~ m/[nUR]/ ||
  248. &error("tarfile \`$tarname' already exists, not overwriting,".
  249. " giving up; use -sU or -sR to override");
  250. } elsif ($! != ENOENT) {
  251. &syserr("unable to check for existence of \`$tarname'");
  252. }
  253. #print STDERR ">$tarname|$tardirbase|$tardirname<\n";
  254. print("$progname: building $sourcepackage in $tarname\n")
  255. || &syserr("write building tar message");
  256. &forkgzipwrite("$tarname.new");
  257. defined($c2= fork) || &syserr("fork for tar");
  258. if (!$c2) {
  259. chdir($tardirbase) || &syserr("chdir to above (orig) source $tardirbase");
  260. #system('pwd && ls');
  261. open(STDOUT,">&GZIP") || &syserr("reopen gzip for tar");
  262. # FIXME: put `--' argument back when tar is fixed
  263. exec('tar','-cf','-',$tardirname); &syserr("exec tar");
  264. }
  265. close(GZIP);
  266. &reapgzip;
  267. $c2 == waitpid($c2,0) || &syserr("wait for tar");
  268. $? && !(WIFSIGNALED($c2) && WTERMSIG($c2) == SIGPIPE) && subprocerr("tar");
  269. rename("$tarname.new",$tarname) ||
  270. &syserr("unable to rename \`$tarname.new' (newly created) to \`$tarname'");
  271. } else {
  272. print("$progname: building $sourcepackage using existing $tarname\n")
  273. || &syserr("write using existing tar message");
  274. }
  275. addfile("$tarname");
  276. if ($sourcestyle =~ m/[kpKP]/) {
  277. if (stat($origdir)) {
  278. $sourcestyle =~ m/[KP]/ ||
  279. &error("orig dir \`$origdir' already exists, not overwriting,".
  280. " giving up; use -sA, -sK or -sP to override");
  281. erasedir($origdir);
  282. } elsif ($! != ENOENT) {
  283. &syserr("unable to check for existence of orig dir \`$origdir'");
  284. }
  285. $expectprefix= $origdir; $expectprefix =~ s,^\./,,;
  286. checktarsane($origtargz,$expectprefix);
  287. mkdir("$origtargz.tmp-nest",0755) ||
  288. &syserr("unable to create \`$origtargz.tmp-nest'");
  289. extracttar($origtargz,"$origtargz.tmp-nest",$expectprefix);
  290. rename("$origtargz.tmp-nest/$expectprefix",$expectprefix) ||
  291. &syserr("unable to rename \`$origtargz.tmp-nest/$expectprefix' to ".
  292. "\`$expectprefix'");
  293. rmdir("$origtargz.tmp-nest") ||
  294. &syserr("unable to remove \`$origtargz.tmp-nest'");
  295. }
  296. if ($sourcestyle =~ m/[kpursKPUR]/) {
  297. print("$progname: building $sourcepackage in $basenamerev.diff.gz\n")
  298. || &syserr("write building diff message");
  299. &forkgzipwrite("$basenamerev.diff.gz");
  300. defined($c2= open(FIND,"-|")) || &syserr("fork for find");
  301. if (!$c2) {
  302. chdir($dir) || &syserr("chdir to $dir for find");
  303. exec('find','.','-print0'); &syserr("exec find");
  304. }
  305. $/= "\0";
  306. file:
  307. while (defined($fn= <FIND>)) {
  308. $fn =~ s/\0$//;
  309. next file if $fn =~ m/$diff_ignore_regexp/o;
  310. $fn =~ s,^\./,,;
  311. lstat("$dir/$fn") || &syserr("cannot stat file $dir/$fn");
  312. if (-l _) {
  313. $type{$fn}= 'symlink';
  314. &checktype('-l') || next;
  315. defined($n= readlink("$dir/$fn")) ||
  316. &syserr("cannot read link $dir/$fn");
  317. defined($n2= readlink("$origdir/$fn")) ||
  318. &syserr("cannot read orig link $origdir/$fn");
  319. $n eq $n2 || &unrepdiff2("symlink to $n2","symlink to $n");
  320. } elsif (-f _) {
  321. $type{$fn}= 'plain file';
  322. if (!lstat("$origdir/$fn")) {
  323. $! == ENOENT || &syserr("cannot stat orig file $origdir/$fn");
  324. $ofnread= '/dev/null';
  325. } elsif (-f _) {
  326. $ofnread= "$origdir/$fn";
  327. } else {
  328. &unrepdiff2("something else","plain file");
  329. next;
  330. }
  331. defined($c3= open(DIFFGEN,"-|")) || &syserr("fork for diff");
  332. if (!$c3) {
  333. $ENV{'LANG'}= 'C';
  334. $ENV{'LC_ALL'}= 'C';
  335. exec('diff','-u',
  336. '-L',"$basedirname.orig/$fn",
  337. '-L',"$basedirname/$fn",
  338. '--',"$ofnread","$dir/$fn"); &syserr("exec diff");
  339. }
  340. $difflinefound= 0;
  341. $/= "\n";
  342. while (<DIFFGEN>) {
  343. if (m/^binary/i) {
  344. close(DIFFGEN); $/= "\0";
  345. &unrepdiff("binary file contents changed");
  346. next file;
  347. } elsif (m/^[-+\@ ]/) {
  348. $difflinefound=1;
  349. } elsif (m/^\\ No newline at end of file$/) {
  350. &warn("file $fn has no final newline ".
  351. "(either original or modified version)");
  352. } else {
  353. s/\n$//;
  354. &internerr("unknown line from diff -u on $fn: \`$_'");
  355. }
  356. print(GZIP $_) || &syserr("failed to write to gzip");
  357. }
  358. close(DIFFGEN); $/= "\0";
  359. if (WIFEXITED($?) && (($es=WEXITSTATUS($?))==0 || $es==1)) {
  360. if ($es==1 && !$difflinefound) {
  361. &unrepdiff("diff gave 1 but no diff lines found");
  362. }
  363. } else {
  364. subprocerr("diff on $dir/$fn");
  365. }
  366. } elsif (-p _) {
  367. $type{$fn}= 'pipe';
  368. &checktype('-p');
  369. } elsif (-b _ || -c _ || -S _) {
  370. &unrepdiff("device or socket is not allowed");
  371. } elsif (-d _) {
  372. $type{$fn}= 'directory';
  373. } else {
  374. &unrepdiff("unknown file type ($!)");
  375. }
  376. }
  377. close(FIND); $? && subprocerr("find on $dir");
  378. close(GZIP) || &syserr("finish write to gzip pipe");
  379. &reapgzip;
  380. defined($c2= open(FIND,"-|")) || &syserr("fork for 2nd find");
  381. if (!$c2) {
  382. chdir($origdir) || &syserr("chdir to $origdir for 2nd find");
  383. exec('find','.','-print0'); &syserr("exec 2nd find");
  384. }
  385. $/= "\0";
  386. while (defined($fn= <FIND>)) {
  387. $fn =~ s/\0$//;
  388. next if $fn =~ m/$diff_ignore_regexp/o;
  389. $fn =~ s,^\./,,;
  390. next if defined($type{$fn});
  391. lstat("$origdir/$fn") || &syserr("cannot check orig file $origdir/$fn");
  392. if (-f _) {
  393. &warn("ignoring deletion of file $fn");
  394. } elsif (-d _) {
  395. &warn("ignoring deletion of directory $fn");
  396. } elsif (-l _) {
  397. &warn("ignoring deletion of symlink $fn");
  398. } else {
  399. &unrepdiff2('not a file, directory or link','nonexistent');
  400. }
  401. }
  402. close(FIND); $? && subprocerr("find on $dirname");
  403. &addfile("$basenamerev.diff.gz");
  404. }
  405. if ($sourcestyle =~ m/[prPR]/) {
  406. erasedir($origdir);
  407. }
  408. print("$progname: building $sourcepackage in $basenamerev.dsc\n")
  409. || &syserr("write building message");
  410. open(STDOUT,"> $basenamerev.dsc") || &syserr("create $basenamerev.dsc");
  411. &outputclose(1);
  412. if ($ur) {
  413. print(STDERR "$progname: unrepresentable changes to source\n")
  414. || &syserr("write error msg: $!");
  415. exit(1);
  416. }
  417. exit(0);
  418. } else {
  419. $sourcestyle =~ y/X/p/;
  420. $sourcestyle =~ m/[pun]/ ||
  421. &usageerr("source handling style -s$sourcestyle not allowed with -x");
  422. @ARGV==1 || &usageerr("-x needs exactly one argument, the .dsc");
  423. $dsc= shift(@ARGV);
  424. $dsc= "./$dsc" unless $dsc =~ m:^/:;
  425. $dscdir= $dsc; $dscdir= "./$dscdir" unless $dsc =~ m,^/|^\./,;
  426. $dscdir =~ s,/[^/]+$,,;
  427. open(CDATA,"< $dsc") || &error("cannot open .dsc file $dsc: $!");
  428. &parsecdata('S',-1,"source control file $dsc");
  429. close(CDATA);
  430. for $f (qw(Source Version Files)) {
  431. defined($fi{"S $f"}) ||
  432. &error("missing critical source control field $f");
  433. }
  434. if (defined $fi{'S Format'}) {
  435. $dscformat=$fi{'S Format'};
  436. if (not $dscformat =~ /^1\./) {
  437. &error("Unsupported format of .dsc file ($dscformat)");
  438. }
  439. }
  440. $sourcepackage =~ m/[^.0-9]/ &&
  441. &error("dsc format contains illegal character \`$&'");
  442. $sourcepackage= $fi{'S Source'};
  443. $sourcepackage =~ m/[^-+.0-9a-z]/ &&
  444. &error("source package name contains illegal character \`$&'");
  445. $sourcepackage =~ m/^[0-9a-z]./ ||
  446. &error("source package name is too short or starts with non-alphanum");
  447. $version= $fi{'S Version'};
  448. $version =~ m/[^-+:.0-9a-zA-Z]/ &&
  449. &error("version number contains illegal character \`$&'");
  450. $version =~ s/^\d+://;
  451. if ($version =~ m/-([^-]+)$/) {
  452. $baseversion= $`; $revision= $1;
  453. } else {
  454. $baseversion= $version; $revision= '';
  455. }
  456. $files= $fi{'S Files'};
  457. for $file (split(/\n /,$files)) {
  458. next if $file eq '';
  459. $file =~ m/^([0-9a-f]{32})[ \t]+(\d+)[ \t]+([0-9a-zA-Z][-+:.,=0-9a-zA-Z_]+)$/
  460. || &error("Files field contains bad line \`$file'");
  461. ($md5sum{$3},$size{$3},$file) = ($1,$2,$3);
  462. &setfile(\$tarfile) if $file =~ m/\.tar\.gz$/;
  463. &setfile(\$difffile) if $file =~ m/\.diff\.gz$/;
  464. }
  465. $newdirectory= $sourcepackage.'-'.$baseversion;
  466. $expectprefix= $newdirectory; $expectprefix.= '.orig' if length($difffile);
  467. length($tarfile) || &error("no tarfile in Files field");
  468. checkstats($tarfile);
  469. checkstats($difffile) if length($difffile);
  470. checktarsane("$dscdir/$tarfile",$expectprefix);
  471. if (length($difffile)) {
  472. &forkgzipread("$dscdir/$difffile");
  473. $/="\n";
  474. $_ = <GZIP>;
  475. while ($_ || !eof(GZIP)) {
  476. # read file header (---/+++ pair)
  477. s/\n$// or &error("diff is missing trailing newline");
  478. /^--- / or &error("expected ^--- in line $. of diff");
  479. $fn= $';
  480. substr($fn,0,length($expectprefix)+1) eq "$expectprefix/" ||
  481. &error("diff patches file ($fn) not in expected subdirectory");
  482. $fn =~ m/\.dpkg-orig$/ &&
  483. &error("diff patches file with name ending .dpkg-orig");
  484. $dirname= $fn;
  485. if ($dirname =~ s,/[^/]+$,, && !defined($dirincluded{$dirname})) {
  486. $dirtocreate{$dirname} = 1;
  487. }
  488. defined($notfileobject{$fn}) &&
  489. &error("diff patches something which is not a plain file");
  490. $_= <GZIP>; s/\n$// ||
  491. &error("diff finishes in middle of ---/+++ (line $.)");
  492. $_ eq '+++ '.$newdirectory.substr($fn,length($expectprefix)) ||
  493. &error("line after --- for file $fn isn't as expected");
  494. $filepatched{$fn}++ && &error("diff patches file $fn twice");
  495. # read hunks
  496. my $hunk = 0;
  497. while (($_ = <GZIP>) && !/^--- /) {
  498. # read hunk header (@@)
  499. s/\n$// or &error("diff is missing trailing newline");
  500. next if /^\\ No newline/;
  501. /^@@ -\d+(,(\d+))? \+\d+(,(\d+))? @\@$/ or
  502. &error("Expected ^@@ in line $. of diff");
  503. my ($olines, $nlines) = ($1 ? $2 : 1, $3 ? $4 : 1);
  504. ++$hunk;
  505. # read hunk
  506. while ($olines || $nlines) {
  507. $_ = <GZIP> or &error("unexpected end of diff");
  508. s/\n$// or &error("diff is missing trailing newline");
  509. next if /^\\ No newline/;
  510. if (/^ /) { --$olines; --$nlines; }
  511. elsif (/^-/) { --$olines; }
  512. elsif (/^\+/) { --$nlines; }
  513. else { &error("expected [ +-] at start of line $. of diff"); }
  514. }
  515. }
  516. $hunk or &error("expected ^\@\@ at line $. of diff");
  517. }
  518. close(GZIP);
  519. &reapgzip;
  520. }
  521. print("$progname: extracting $sourcepackage in $newdirectory\n")
  522. || &syserr("write extracting message");
  523. &erasedir($newdirectory);
  524. &erasedir("$newdirectory.orig");
  525. mkdir("$expectprefix.tmp-nest",0755)
  526. || &syserr("unable to create \`$expectprefix.tmp-nest'");
  527. system "chmod", "g-s", "$expectprefix.tmp-nest";
  528. extracttar("$dscdir/$tarfile","$expectprefix.tmp-nest","$expectprefix");
  529. rename("$expectprefix.tmp-nest/$expectprefix","$expectprefix")
  530. || &syserr("unable to rename \`$expectprefix.tmp-nest/$expectprefix' "
  531. ."to \`$expectprefix'");
  532. rmdir("$expectprefix.tmp-nest")
  533. || &syserr("unable to remove \`$expectprefix.tmp-nest'");
  534. for $dircreate (keys %dirtocreate) {
  535. $dircreatem= "";
  536. for $dircreatep (split("/",$dirc)) {
  537. $dircreatem.= $dircreatep;
  538. if (!lstat($dircreatem)) {
  539. $! == ENOENT || &syserr("cannot stat $dircreatem");
  540. mkdir($dircreatem,0777)
  541. || &syserr("failed to create $dircreatem subdirectory");
  542. }
  543. else {
  544. -d _ || &error("diff patches file in directory \`$dircreate',"
  545. ." but $dircreatem isn't a directory !");
  546. }
  547. }
  548. }
  549. if (length($difffile)) {
  550. rename($expectprefix,$newdirectory) ||
  551. &syserr("failed to rename newly-extracted $expectprefix to $newdirectory");
  552. if ($sourcestyle =~ m/u/) {
  553. mkdir("$expectprefix.tmp-nest",0755)
  554. || &syserr("unable to create \`$expectprefix.tmp-nest'");
  555. system "chmod", "g-s", "$expectprefix.tmp-nest";
  556. extracttar("$dscdir/$tarfile","$expectprefix.tmp-nest",
  557. "$expectprefix");
  558. rename("$expectprefix.tmp-nest/$expectprefix","$expectprefix")
  559. || &syserr("unable to rename \`$expectprefix.tmp-nest/"
  560. ."$expectprefix' to \`$expectprefix'");
  561. rmdir("$expectprefix.tmp-nest")
  562. || &syserr("unable to remove \`$expectprefix.tmp-nest'");
  563. } elsif ($sourcestyle =~ m/p/) {
  564. stat("$dscdir/$tarfile") ||
  565. &syserr("failed to stat \`$dscdir/$tarfile' to see if need to copy");
  566. ($dsctardev,$dsctarino) = stat _;
  567. $dumptar= $sourcepackage.'_'.$baseversion.'.orig.tar.gz';
  568. if (!stat($dumptar)) {
  569. $! == ENOENT || &syserr("failed to check destination \`$dumptar'".
  570. " to see if need to copy");
  571. } else {
  572. ($dumptardev,$dumptarino) = stat _;
  573. if ($dumptardev == $dsctardev && $dumptarino == $dsctarino) {
  574. $dumptar= '';
  575. }
  576. }
  577. if (length($dumptar)) {
  578. system('cp','--',"$dscdir/$tarfile","$dumptar");
  579. $? && subprocerr("cp $dscdir/$tarfile to $dumptar");
  580. }
  581. }
  582. &forkgzipread("$dscdir/$difffile");
  583. defined($c2= fork) || &syserr("fork for patch");
  584. if (!$c2) {
  585. open(STDIN,"<&GZIP") || &syserr("reopen gzip for patch");
  586. chdir($newdirectory) || &syserr("chdir to $newdirectory for patch");
  587. $ENV{'LANG'}= 'C';
  588. exec('patch','-s','-t','-F','0','-N','-p1','-u',
  589. '-V','never','-g0','-b','-z','.dpkg-orig');
  590. &syserr("exec patch");
  591. }
  592. close(GZIP);
  593. $c2 == waitpid($c2,0) || &syserr("wait for patch");
  594. $? && subprocerr("patch");
  595. &reapgzip;
  596. for $fn (keys %filepatched) {
  597. $ftr= "$newdirectory/".substr($fn,length($expectprefix)+1).".dpkg-orig";
  598. unlink($ftr) || &syserr("remove patch backup file $ftr");
  599. }
  600. if (!(@s= lstat("$newdirectory/debian/rules"))) {
  601. $! == ENOENT || &syserr("cannot stat $newdirectory/debian/rules");
  602. &warn("$newdirectory/debian/rules does not exist");
  603. } elsif (-f _) {
  604. chmod($s[2] | 0111, "$newdirectory/debian/rules") ||
  605. &syserr("cannot make $newdirectory/debian/rules executable");
  606. } else {
  607. &warn("$newdirectory/debian/rules is not a plain file");
  608. }
  609. }
  610. $execmode= 0777 & ~umask;
  611. (@s= stat('.')) || &syserr("cannot stat \`.'");
  612. $dirmode= $execmode | ($s[2] & 02000);
  613. $plainmode= $execmode & ~0111;
  614. $fifomode= ($plainmode & 0222) | (($plainmode & 0222) << 1);
  615. for $fn (@filesinarchive) {
  616. $fn= substr($fn,length($expectprefix)+1);
  617. $fn= "$newdirectory/$fn";
  618. (@s= lstat($fn)) || &syserr("cannot stat extracted object \`$fn'");
  619. $mode= $s[2];
  620. if (-d _) {
  621. $newmode= $dirmode;
  622. } elsif (-f _) {
  623. $newmode= ($mode & 0111) ? $execmode : $plainmode;
  624. } elsif (-p _) {
  625. $newmode= $fifomode;
  626. } elsif (!-l _) {
  627. &internerr("unknown object \`$fn' after extract (mode ".
  628. sprintf("0%o",$mode).")");
  629. } else { next; }
  630. next if ($mode & 07777) == $newmode;
  631. chmod($newmode,$fn) ||
  632. &syserr(sprintf("cannot change mode of \`%s' to 0%o from 0%o",
  633. $fn,$newmode,$mode));
  634. }
  635. exit(0);
  636. }
  637. sub checkstats {
  638. my ($f) = @_;
  639. my @s;
  640. my $m;
  641. open(STDIN,"< $dscdir/$f") || &syserr("cannot read $dscdir/$f");
  642. (@s= stat(STDIN)) || &syserr("cannot fstat $dscdir/$f");
  643. $s[7] == $size{$f} || &error("file $f has size $s[7] instead of expected $size{$f}");
  644. $m= `md5sum`; $? && subprocerr("md5sum $f"); $m =~ s/\n$//;
  645. $m =~ s/ *-$//; # Remove trailing spaces and -, to work with GNU md5sum
  646. $m =~ m/^[0-9a-f]{32}$/ || &failure("md5sum of $f gave bad output \`$m'");
  647. $m eq $md5sum{$f} || &error("file $f has md5sum $m instead of expected $md5sum{$f}");
  648. open(STDIN,"</dev/null") || &syserr("reopen stdin from /dev/null");
  649. }
  650. sub erasedir {
  651. my ($dir) = @_;
  652. if (!lstat($dir)) {
  653. $! == ENOENT && return;
  654. &syserr("cannot stat directory $dir (before removal)");
  655. }
  656. system 'rm','-rf','--',$dir;
  657. $? && subprocerr("rm -rf $dir");
  658. if (!stat($dir)) {
  659. $! == ENOENT && return;
  660. &syserr("unable to check for removal of dir \`$dir'");
  661. }
  662. &failure("rm -rf failed to remove \`$dir'");
  663. }
  664. use strict 'vars';
  665. sub checktarcpio {
  666. my ($tarfileread, $wpfx) = @_;
  667. my ($tarprefix, $c2);
  668. @filesinarchive = ();
  669. # make <CPIO> read from the uncompressed archive file
  670. &forkgzipread ("$tarfileread");
  671. if (! defined ($c2 = open (CPIO,"-|"))) { &syserr ("fork for cpio"); }
  672. if (!$c2) {
  673. $ENV{'LANG'} = 'C';
  674. open (STDIN,"<&GZIP") || &syserr ("reopen gzip for cpio");
  675. &cpiostderr;
  676. exec ('cpio','-0t');
  677. &syserr ("exec cpio");
  678. }
  679. close (GZIP);
  680. $/ = "\0";
  681. while (defined ($fn = <CPIO>)) {
  682. $fn =~ s/\0$//;
  683. # store printable name of file for error messages
  684. my $pname = $fn;
  685. $pname =~ y/ -~/?/c;
  686. if (! $tarprefix) {
  687. if ($fn =~ m/\n/) {
  688. &error("first output from cpio -0t (from \`$tarfileread') ".
  689. "contains newline - you probably have an out of ".
  690. "date version of cpio. GNU cpio 2.4.2-2 is known to work");
  691. }
  692. $tarprefix = ($fn =~ m,([^/]*)[/],)[0];
  693. # need to check for multiple dots on some operating systems
  694. # empty tarprefix (due to regex failer) will match emptry string
  695. if ($tarprefix =~ /^[.]*$/) {
  696. &error("tarfile \`$tarfileread' does not extract into a ".
  697. "directory off the current directory ($tarprefix from $pname)");
  698. }
  699. }
  700. if ($fn =~ m/\n/) {
  701. &error ("tarfile \`$tarfileread' contains object with".
  702. " newline in its name ($pname)");
  703. }
  704. next if ($fn eq '././@LongLink');
  705. my $fprefix = substr ($fn, 0, length ($tarprefix));
  706. my $slash = substr ($fn, length ($tarprefix), 1);
  707. if ((($slash ne '/') && ($slash ne '')) || ($fprefix ne $tarprefix)) {
  708. &error ("tarfile \`$tarfileread' contains object ($pname) ".
  709. "not in expected directory ($tarprefix)");
  710. }
  711. # need to check for multiple dots on some operating systems
  712. if ($fn =~ m/[.]{2,}/) {
  713. &error ("tarfile \`$tarfileread' contains object with".
  714. " /../ in its name ($pname)");
  715. }
  716. push (@filesinarchive, $fn);
  717. }
  718. close (CPIO);
  719. $? && subprocerr ("cpio");
  720. &reapgzip;
  721. $/= "\n";
  722. my $tarsubst = quotemeta ($tarprefix);
  723. @filesinarchive = map { s/^$tarsubst/$wpfx/; $_ } @filesinarchive;
  724. return $tarprefix;
  725. }
  726. sub checktarsane {
  727. my ($tarfileread, $wpfx) = @_;
  728. my ($c2);
  729. %dirincluded = ();
  730. %notfileobject = ();
  731. my $tarprefix = &checktarcpio ($tarfileread, $wpfx);
  732. # make <TAR> read from the uncompressed archive file
  733. &forkgzipread ("$tarfileread");
  734. if (! defined ($c2 = open (TAR,"-|"))) { &syserr ("fork for tar -t"); }
  735. if (! $c2) {
  736. $ENV{'LANG'}= 'C';
  737. open (STDIN, "<&GZIP") || &syserr ("reopen gzip for tar -t");
  738. exec ('tar', '-vvtf', '-'); &syserr ("exec tar -vvtf -");
  739. }
  740. close (GZIP);
  741. my $efix= 0;
  742. while (<TAR>) {
  743. chomp;
  744. if (! m,^(\S{10})\s,) {
  745. &error("tarfile \`$tarfileread' contains unknown object ".
  746. "listed by tar as \`$_'");
  747. }
  748. my $mode = $1;
  749. $mode =~ s/^([-dpsl])// ||
  750. &error("tarfile \`$tarfileread' contains object \`$fn' with ".
  751. "unknown or forbidden type \`".substr($_,0,1)."'");
  752. my $type = $&;
  753. if ($mode =~ /^l/) { $_ =~ s/ -> .*//; }
  754. s/ link to .+//;
  755. my @tarfields = split(' ', $_, 6);
  756. if (@tarfields < 6) {
  757. &error ("tarfile \`$tarfileread' contains incomplete entry \`$_'\n");
  758. }
  759. my $tarfn = deoctify ($tarfields[5]);
  760. # store printable name of file for error messages
  761. my $pname = $tarfn;
  762. $pname =~ y/ -~/?/c;
  763. # fetch name of file as given by cpio
  764. $fn = $filesinarchive[$efix++];
  765. if ($tarfn ne $fn) {
  766. if ((length ($fn) == 99) && (length ($tarfn) >= 99)
  767. && (substr ($fn, 0, 99) eq substr ($tarfn, 0, 99))) {
  768. # this file doesn't match because cpio truncated the name
  769. # to the first 100 characters. let it slide for now.
  770. &warn ("filename \`$pname' was truncated by cpio;" .
  771. " unable to check full pathname");
  772. } else {
  773. &error ("tarfile \`$tarfileread' contains unexpected object".
  774. " listed by tar as \`$_'; expected \`$pname'");
  775. }
  776. }
  777. # if cpio truncated the name above,
  778. # we still can't allow files to expand into /../
  779. # need to check for multiple dots on some operating systems
  780. if ($tarfn =~ m/[.]{2,}/) {
  781. &error ("tarfile \`$tarfileread' contains object with".
  782. "/../ in its name ($pname)");
  783. }
  784. if ($tarfn =~ /\.dpkg-orig$/) {
  785. &error ("tarfile \`$tarfileread' contains file with name ending in .dpkg-orig");
  786. }
  787. if ($mode =~ /[sStT]/ && $type ne 'd') {
  788. &error ("tarfile \`$tarfileread' contains setuid, setgid".
  789. " or sticky object \`$pname'");
  790. }
  791. if ($tarfn eq "$tarprefix/debian" && $type ne 'd') {
  792. &error ("tarfile \`$tarfileread' contains object \`debian'".
  793. " that isn't a directory");
  794. }
  795. if ($type eq 'd') { $tarfn =~ s,/$,,; }
  796. my $dirname = $tarfn;
  797. if (($dirname =~ s,/[^/]+$,,) && (! defined ($dirincluded{$dirname}))) {
  798. &error ("tarfile \`$tarfileread' contains object \`$pname' but its containing ".
  799. "directory \`$dirname' does not precede it");
  800. }
  801. if ($type eq 'd') { $dirincluded{$tarfn} = 1; }
  802. if ($type ne '-') { $notfileobject{$tarfn} = 1; }
  803. }
  804. close (TAR);
  805. #$? && subprocerr ("tar -vvtf");
  806. &reapgzip;
  807. my $tarsubst = quotemeta ($tarprefix);
  808. %dirincluded = map { s/^$tarsubst/$wpfx/; $_=>1 } (keys %dirincluded);
  809. %notfileobject = map { s/^$tarsubst/$wpfx/; $_=>1 } (keys %notfileobject);
  810. }
  811. no strict 'vars';
  812. sub extracttar {
  813. my ($tarfileread,$dirchdir,$newtopdir) = @_;
  814. &forkgzipread("$tarfileread");
  815. defined($c2= fork) || &syserr("fork for tar -xkf -");
  816. if (!$c2) {
  817. open(STDIN,"<&GZIP") || &syserr("reopen gzip for tar -xkf -");
  818. &cpiostderr;
  819. chdir("$dirchdir") || &syserr("cannot chdir to \`$dirchdir' for tar extract");
  820. exec('tar','-xkf','-'); &syserr("exec tar -xkf -");
  821. }
  822. close(GZIP);
  823. $c2 == waitpid($c2,0) || &syserr("wait for tar -xkf -");
  824. $? && subprocerr("tar -xkf -");
  825. &reapgzip;
  826. opendir(D,"$dirchdir") || &syserr("Unable to open dir $dirchdir");
  827. @dirchdirfiles = grep($_ ne "." && $_ ne "..",readdir(D));
  828. closedir(D) || &syserr("Unable to close dir $dirchdir");
  829. if (@dirchdirfiles==1 && -d "$dirchdir/$dirchdirfiles[0]") {
  830. rename("$dirchdir/$dirchdirfiles[0]", "$dirchdir/$newtopdir") ||
  831. &syserr("Unable to rename $dirchdir/$dirchdirfiles[0] to ".
  832. "$dirchdir/$newtopdir");
  833. } else {
  834. mkdir("$dirchdir/$newtopdir", 0777) ||
  835. &syserr("Unable to mkdir $dirchdir/$newtopdir");
  836. for (@dirchdirfiles) {
  837. rename("$dirchdir/$_", "$dirchdir/$newtopdir/$_") ||
  838. &syserr("Unable to rename $dirchdir/$_ to ".
  839. "$dirchdir/$newtopdir/$_");
  840. }
  841. }
  842. }
  843. sub cpiostderr {
  844. open(STDERR,"| egrep -v '^[0-9]+ blocks\$' >&2") ||
  845. &syserr("reopen stderr for tar to grep out blocks message");
  846. }
  847. sub setfile {
  848. my ($varref) = @_;
  849. if (defined ($$varref)) {
  850. &error ("repeated file type - files " . $$varref . " and $file");
  851. }
  852. $$varref = $file;
  853. }
  854. sub checktype {
  855. if (!lstat("$origdir/$fn")) {
  856. &unrepdiff2("nonexistent",$type{$fn});
  857. } else {
  858. $v= eval("$_[0] _ ? 2 : 1"); $v || &internerr("checktype $@ ($_[0])");
  859. return 1 if $v == 2;
  860. &unrepdiff2("something else",$type{$fn});
  861. }
  862. return 0;
  863. }
  864. sub setopmode {
  865. defined($opmode) && &usageerr("only one of -x or -b allowed, and only once");
  866. $opmode= $_[0];
  867. }
  868. sub unrepdiff {
  869. print(STDERR "$progname: cannot represent change to $fn: $_[0]\n")
  870. || &syserr("write syserr unrep");
  871. $ur++;
  872. }
  873. sub unrepdiff2 {
  874. print(STDERR "$progname: cannot represent change to $fn:\n".
  875. "$progname: new version is $_[1]\n".
  876. "$progname: old version is $_[0]\n")
  877. || &syserr("write syserr unrep");
  878. $ur++;
  879. }
  880. sub forkgzipwrite {
  881. #print STDERR "forkgzipwrite $_[0]\n";
  882. open(GZIPFILE,"> $_[0]") || &syserr("create file $_[0]");
  883. pipe(GZIPREAD,GZIP) || &syserr("pipe for gzip");
  884. defined($cgz= fork) || &syserr("fork for gzip");
  885. if (!$cgz) {
  886. open(STDIN,"<&GZIPREAD") || &syserr("reopen gzip pipe"); close(GZIPREAD);
  887. close(GZIP); open(STDOUT,">&GZIPFILE") || &syserr("reopen tar.gz");
  888. exec('gzip','-9'); &syserr("exec gzip");
  889. }
  890. close(GZIPREAD);
  891. $gzipsigpipeok= 0;
  892. }
  893. sub forkgzipread {
  894. #print STDERR "forkgzipread $_[0]\n";
  895. local $SIG{PIPE} = 'DEFAULT';
  896. open(GZIPFILE,"< $_[0]") || &syserr("read file $_[0]");
  897. pipe(GZIP,GZIPWRITE) || &syserr("pipe for gunzip");
  898. defined($cgz= fork) || &syserr("fork for gunzip");
  899. if (!$cgz) {
  900. open(STDOUT,">&GZIPWRITE") || &syserr("reopen gunzip pipe"); close(GZIPWRITE);
  901. close(GZIP); open(STDIN,"<&GZIPFILE") || &syserr("reopen input file");
  902. exec('gunzip'); &syserr("exec gunzip");
  903. }
  904. close(GZIPWRITE);
  905. $gzipsigpipeok= 1;
  906. }
  907. sub reapgzip {
  908. #print STDERR "reapgzip $_[0]\n";
  909. $cgz == waitpid($cgz,0) || &syserr("wait for gzip");
  910. !$? || ($gzipsigpipeok && WIFSIGNALED($?) && WTERMSIG($?)==SIGPIPE) ||
  911. subprocerr("gzip");
  912. close(GZIPFILE);
  913. }
  914. sub addfile {
  915. my ($filename)= @_;
  916. stat($filename) || &syserr("could not stat output file \`$filename'");
  917. $size= (stat _)[7];
  918. my $md5sum= `md5sum <$filename`;
  919. $? && &subprocerr("md5sum $filename");
  920. $md5sum =~ s/^([0-9a-f]{32})\n$/$1/ || &failure("md5sum gave bogus output \`$_'");
  921. $f{'Files'}.= "\n $md5sum $size $filename";
  922. }
  923. # replace \ddd with their corresponding character, refuse \ddd > \377
  924. # modifies $_ (hs)
  925. {
  926. my $backslash;
  927. sub deoctify {
  928. my $fn= $_[0];
  929. $backslash= sprintf("\\%03o", unpack("C", "\\")) if !$backslash;
  930. s/\\{2}/$backslash/g;
  931. @_= split(/\\/, $fn);
  932. foreach (@_) {
  933. /^(\d{3})/ or next;
  934. &failure("bogus character `\\$1' in `$fn'\n") if oct($1) > 255;
  935. $_= pack("c", oct($1)) . $';
  936. }
  937. return join("", @_);
  938. } }