dpkg-source.pl 38 KB

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