diff options
| author | Glenn Morris | 2014-05-25 19:28:09 -0700 |
|---|---|---|
| committer | Glenn Morris | 2014-05-25 19:28:09 -0700 |
| commit | 015936fba1bcaa51b7886a73144d4c088200c0aa (patch) | |
| tree | c9628339352c1a97e574df28966e977143c43e41 /lib-src | |
| parent | 5e26d9849a79bf78fda821979fc937f7e5e6df52 (diff) | |
| parent | e8f2cc26e712f42f6391fa52cd67c3e791096f1e (diff) | |
| download | emacs-015936fba1bcaa51b7886a73144d4c088200c0aa.tar.gz emacs-015936fba1bcaa51b7886a73144d4c088200c0aa.zip | |
Merge from emacs-24; up to 2014-05-26T10:21:18Z!rgm@gnu.org
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 10 | ||||
| -rwxr-xr-x | lib-src/rcs2log | 59 |
2 files changed, 53 insertions, 16 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 3ac401b16a3..cedd9ab8965 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2014-05-26 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Fix rcs2log problems with CVS. | ||
| 4 | Problem reported by Glenn Morris in | ||
| 5 | <http://lists.gnu.org/archive/html/emacs-devel/2014-05/msg00277.html>. | ||
| 6 | Plus, fix some security and filename quoting problems. | ||
| 7 | * rcs2log (logdir): Prefer mktemp if available. | ||
| 8 | (logdir, llogdir): Work even if TMPDIR begins with '-' or has spaces. | ||
| 9 | (output_authors, main awk script): Parse more-recent CVS output format. | ||
| 10 | |||
| 1 | 2014-05-19 Paul Eggert <eggert@cs.ucla.edu> | 11 | 2014-05-19 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 12 | ||
| 3 | Remove dependencies on getline and getdelim. | 13 | Remove dependencies on getline and getdelim. |
diff --git a/lib-src/rcs2log b/lib-src/rcs2log index a0a75e390fb..8dd9cdcf2bb 100755 --- a/lib-src/rcs2log +++ b/lib-src/rcs2log | |||
| @@ -205,11 +205,19 @@ month_data=' | |||
| 205 | m[9]="Oct"; m[10]="Nov"; m[11]="Dec" | 205 | m[9]="Oct"; m[10]="Nov"; m[11]="Dec" |
| 206 | ' | 206 | ' |
| 207 | 207 | ||
| 208 | logdir=$TMPDIR/rcs2log$$ | 208 | if type mktemp >/dev/null 2>&1; then |
| 209 | llogout=$logdir/l | 209 | logdir=`mktemp -d` |
| 210 | else | ||
| 211 | logdir=$TMPDIR/rcs2log$$ | ||
| 212 | (umask 077 && mkdir "$logdir") | ||
| 213 | fi || exit | ||
| 214 | case $logdir in | ||
| 215 | -*) logdir=./$logdir;; | ||
| 216 | esac | ||
| 210 | trap exit 1 2 13 15 | 217 | trap exit 1 2 13 15 |
| 211 | trap "rm -fr $logdir 2>/dev/null" 0 | 218 | trap "rm -fr \"$logdir\" 2>/dev/null" 0 |
| 212 | (umask 077 && exec mkdir $logdir) || exit | 219 | |
| 220 | llogout=$logdir/l | ||
| 213 | 221 | ||
| 214 | # If no rlog-format log file is given, generate one into $rlogfile. | 222 | # If no rlog-format log file is given, generate one into $rlogfile. |
| 215 | case $rlogfile in | 223 | case $rlogfile in |
| @@ -417,10 +425,10 @@ case $loginFullnameMailaddrs in | |||
| 417 | ?*) | 425 | ?*) |
| 418 | case $loginFullnameMailaddrs in | 426 | case $loginFullnameMailaddrs in |
| 419 | *\"* | *\\*) | 427 | *\"* | *\\*) |
| 420 | sed 's/["\\]/\\&/g' >$llogout <<EOF || exit | 428 | sed 's/["\\]/\\&/g' >"$llogout" <<EOF || exit |
| 421 | $loginFullnameMailaddrs | 429 | $loginFullnameMailaddrs |
| 422 | EOF | 430 | EOF |
| 423 | loginFullnameMailaddrs=`cat $llogout`;; | 431 | loginFullnameMailaddrs=`cat "$llogout"`;; |
| 424 | esac | 432 | esac |
| 425 | 433 | ||
| 426 | oldIFS=$IFS | 434 | oldIFS=$IFS |
| @@ -442,29 +450,33 @@ esac | |||
| 442 | 450 | ||
| 443 | case $logins in | 451 | case $logins in |
| 444 | ?*) | 452 | ?*) |
| 445 | sort -u -o $llogout <<EOF | 453 | sort -u -o "$llogout" <<EOF |
| 446 | $logins | 454 | $logins |
| 447 | EOF | 455 | EOF |
| 448 | ;; | 456 | ;; |
| 449 | '') | 457 | '') |
| 450 | : ;; | 458 | : ;; |
| 451 | esac >$llogout || exit | 459 | esac >"$llogout" || exit |
| 452 | 460 | ||
| 453 | output_authors='/^date: / { | 461 | output_authors='/^date: / { |
| 454 | if ($2 ~ /^[0-9]*[-\/][0-9][0-9][-\/][0-9][0-9]$/ && $3 ~ /^[0-9][0-9]:[0-9][0-9]:[0-9][0-9][-+0-9:]*;$/ && $4 == "author:" && $5 ~ /^[^;]*;$/) { | 462 | cvsformat = $5 == "author:" |
| 455 | print substr($5, 1, length($5)-1) | 463 | if ($2 ~ /^[0-9]*[-\/][0-9][0-9][-\/][0-9][0-9]$/ && (cvsformat ? $3 ~ /^[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/ && $4 ~ /^[-+][0-9:]*;$/ : $3 ~ /^[0-9][0-9]:[0-9][0-9]:[0-9][0-9][-+0-9:]*;$/)) { |
| 464 | author = $(5 + cvsformat) | ||
| 465 | if ($(4 + cvsformat) == "author:" && author ~ /^[^;]*;$/) { | ||
| 466 | print substr(author, 1, length(author)-1) | ||
| 467 | } | ||
| 456 | } | 468 | } |
| 457 | }' | 469 | }' |
| 458 | authors=` | 470 | authors=` |
| 459 | $AWK "$output_authors" <"$rlogfile" | sort -u | comm -23 - $llogout | 471 | $AWK "$output_authors" <"$rlogfile" | sort -u | comm -23 - "$llogout" |
| 460 | ` | 472 | ` |
| 461 | case $authors in | 473 | case $authors in |
| 462 | ?*) | 474 | ?*) |
| 463 | cat >$llogout <<EOF || exit | 475 | cat >"$llogout" <<EOF || exit |
| 464 | $authors | 476 | $authors |
| 465 | EOF | 477 | EOF |
| 466 | initialize_author_script='s/["\\]/\\&/g; s/.*/author[\"&\"] = 1/' | 478 | initialize_author_script='s/["\\]/\\&/g; s/.*/author[\"&\"] = 1/' |
| 467 | initialize_author=`sed -e "$initialize_author_script" <$llogout` | 479 | initialize_author=`sed -e "$initialize_author_script" <"$llogout"` |
| 468 | awkscript=' | 480 | awkscript=' |
| 469 | BEGIN { | 481 | BEGIN { |
| 470 | alphabet = "abcdefghijklmnopqrstuvwxyz" | 482 | alphabet = "abcdefghijklmnopqrstuvwxyz" |
| @@ -644,8 +656,23 @@ $AWK ' | |||
| 644 | } | 656 | } |
| 645 | date = newdate date | 657 | date = newdate date |
| 646 | } | 658 | } |
| 647 | time = substr($3, 1, length($3) - 1) | 659 | time = "" |
| 648 | author = substr($5, 1, length($5)-1) | 660 | for (i = 3; i <= NF; i++) { |
| 661 | time = time $i | ||
| 662 | if (time ~ /;$/) { | ||
| 663 | time = substr(time, 1, length(time) - 1) | ||
| 664 | break | ||
| 665 | } | ||
| 666 | } | ||
| 667 | i++ | ||
| 668 | if ($i == "author:") { | ||
| 669 | author = $(i + 1) | ||
| 670 | if (author ~ /;$/) { | ||
| 671 | author = substr(author, 1, length(author) - 1) | ||
| 672 | } | ||
| 673 | } else { | ||
| 674 | author = "" | ||
| 675 | } | ||
| 649 | printf "%s%s%s%s%s%s%s%s%s%s", filename, SOH, rev, SOH, date, SOH, time, SOH, author, SOH | 676 | printf "%s%s%s%s%s%s%s%s%s%s", filename, SOH, rev, SOH, date, SOH, time, SOH, author, SOH |
| 650 | rev = "?" | 677 | rev = "?" |
| 651 | next | 678 | next |
| @@ -769,7 +796,7 @@ $AWK -F"$SOH" ' | |||
| 769 | 796 | ||
| 770 | # Exit successfully. | 797 | # Exit successfully. |
| 771 | 798 | ||
| 772 | exec rm -fr $logdir | 799 | exec rm -fr "$logdir" |
| 773 | 800 | ||
| 774 | # Local Variables: | 801 | # Local Variables: |
| 775 | # tab-width:4 | 802 | # tab-width:4 |