summaryrefslogtreecommitdiff
path: root/tmac/hyphenex.pl
Commit message (Collapse)AuthorAgeFilesLines
* Avoid Perl's unsafe "<>" operator.Colin Watson2021-01-061-38/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "<>" operator is implemented using the two-argument form of "open", which interprets magic such as pipe characters, allowing execution of arbitrary commands which is unlikely to be expected. Perl >= 5.22 has a "<<>>" operator which avoids this, but also forbids the use of "-" to mean the standard input, which is a facility that the affected groff programs document. ARGV::readonly would probably also fix this, but I fundamentally dislike the approach of escaping data in preparation for a language facility to unescape it, especially when the required escaping is as non-obvious as it is here. (For the same reason, I prefer to use subprocess invocation facilities that allow passing the argument list as a list rather than as a string to be interpreted by the shell.) So I've abandoned this dubious convenience and changed the affected programs to iterate over command-line arguments manually using the three-argument form of open. This change involves an extra level of indentation, so it's a little awkward to review. It consists of changing this form: while (<>) { # or foreach, which is similar but less efficient ... } ... into this: unshift @ARGV, '-' unless @ARGV; foreach my $filename (@ARGV) { my $input; if ($filename eq '-') { $input = \*STDIN; } elsif (not open $input, '<', $filename) { warn $!; next; } while (<$input>) { ... } } Local variation: glilypond doesn't need the initial unshift since that's already handled in contrib/glilypond/args.pl. Fixes: https://bugs.debian.org/920269 [Commit automerged but altered by GBR to omit changes to gropdf, already handled by Deri James in 2fc912f0751320a1fba0094dded38e2df46d1dbe.]
* tmac: Make style fixes.G. Branden Robinson2017-11-181-3/+3
| | | | | | | | | | | | | | | | | * Migrate comments and plain text from `quotes' to 'quotes'. * Flow FSF copyright notices onto one line per the model in the GNU Maintainers' Guide. Put only one space between year range and name of copyright holder. * Update and parallelize editor aid comments. * Reflow comments at 72 columns. tmac/hyphen.cs: * Update FSF address to Franklin Street (the file is under GPLv2). tmac/hyphen.det: * Identify self as "hyphen.det", not "hyphen.den". Signed-off-by: G. Branden Robinson <g.branden.robinson@gmail.com>
* * NEWS: Updated.Werner LEMBERG2007-12-061-3/+3
| | | | | | | | * src/roff/nroff/nroff.sh: Add options -w and -W. * src/roff/nroff/nroff.man: Document them. * tmac/hyphenex.pl: Update header output.
* * tmac/hyphenex.pl: Generate copyright notice (this has beenWerner LEMBERG2007-11-161-1/+4
| | | | | approved By Barbara Beeton). * tmac/hyphenex.us: Updated.
* Add comments. Remove nested paired braces also.Werner LEMBERG2003-04-171-2/+16
|
* * tmac/hyphenex.sh: Replaced with...Werner LEMBERG2003-04-161-0/+64
* tmac/hyphenex.pl: This perl script to avoid sed compatibility nightmares.