Debian Patches

Status for xtrs/4.9d-2

Patch Description Author Forwarded Bugs Origin Last update
this-one-goes-to-c11.patch Align build with the ISO C11 standard.

-- Branden Robinson, 2017-04-04T09:40:13-0400
no
mkdisk-protect-against-overwrites.patch Make mkdisk refuse to clobber files by default.

-- Branden Robinson, 2017-04-09T15:03:04-0400
no
prep-makefiles-for-debian.patch * Set file hierarchy expectations to conform with Debian policy.
* Create destination directories for installed files.
* Let the linker figure out whether we need ncurses; xtrs does not
directly use any ncurses symbols.
* Actually install the cassette script. Enable Makefile.local users to
choose between the C-shell and POSIX-shell implementations.

-- Branden Robinson, 2017-03-23T18:08:52-0400
no
move-error.c-prototypes-to-new-error.h.patch Move diagnostic function prototypes into their own header.

Convert several files from including z80.h to error.h, when they needed
z80.h for nothing but the diagnostic functions.

Add standard library header includes where dependencies were revealed
by the above (since z80.h itself included several standard headers).

compile_rom.c now #includes both error.h and z80.h because it still
needs some of the data types declared in the latter.

G. Branden Robinson <g.branden.robinson@gmail.com>
no
add-warning-diagnostic-function.patch A few places in the code were calling error() with "warning:" in the
argument string, which looked weird.

Make a warn() function for these use cases.

G. Branden Robinson <g.branden.robinson@gmail.com>
no
fix-compiler-warnings.patch * Hoist volatile dummy variable into file scope to silence GCC warning
about variable being set but not used. See, e.g.,
https://stackoverflow.com/questions/21688067/gcc-unused-but-set-variable-warning-on-volatile

* Explicitly declare int type on function arguments with implicit types.

* Get rid of unused variable in help window display function.

* Squash unused variable warnings in trs_cassette.c; add preprocessor
guards to symbols used only when system support is available. Work
around dual usage of sb_address as a boolean (prefer SoundBlaster to
OSS when both are available?) and a hardware address on x86. Throw a
warning the first time (each of) the cassette port or sound port is
written to on systems where there is no supporting sound system for
either. Relocate some #if guards, and one static function so that
there isn't a forward reference to it. Rewrite a call to
trs_orch90_out(0, FLUSH) to orch90_flush(FLUSH) (the former being
exactly what orch90_flush() is defined as), which is how this forward
reference was avoided before. Add comment documenting why
orch90_flush() takes an argument that it ignores.

-- Branden Robinson, 2018-08-08T02:59:45-0400
no
add-ifdef-guards-around-setuid.patch GCC warns about an unused result in trs_xinterface.c. The relevant line
is this.
setuid(getuid());

The web has scary things to say about the above.
https://c-skills.blogspot.com/2008/01/evilness-of-setuidgetuid.html

However, the fix seems easy. Here's why.
1. The code prior to the above call invokes trs_sound_init(), whose
entire body sits in an #ifdef SB_SOUND guard, and if SB_SOUND is
defined, plays around with I/O ports using ioperm(), inb(), and
outb();
2. Poking I/O ports is particular to x86 hardware;
3. Doing so requires root privileges;
4. xtrs is trying to _drop_ root privileges after doing this;
5. This functionality is predicated on having
SoundBlaster-compatible hardware installed;
6. The code preceding the trs_sound_init() call attempts to infer
some SoundBlaster card parameters from an X resource;
7. The corresponding command-line option for setting up a
SoundBlaster card is -sb, about which trs_cassette.c has to say:
"OSS_SOUND seems to work much better than SB_SOUND now, so
SB_SOUND is off by default and -sb has been removed from the
man page";
8. Nothing in the source code ever actually #defines SB_SOUND; you
would have to do it from Make, which Debian never has done.

Therefore, guard all this "Sb" resource reading stuff with #ifdef
SB_SOUND. Now it won't be compiled in to be complained about. Perhaps
all this SoundBlaster stuff should be "#if 0"ed or even deleted, but
I'll leave that up to upstream.

-- Branden Robinson, 2017-03-24T03:15:32-0400
no
stop-ignoring-result-from-fread.patch Quieten compiler warning. Conventional wisdom says you really shouldn't
ignore the return value from fread(), but several functions in this file
do so.

-- Branden Robinson, 2017-03-24T03:40:19-0400
no
make-plain-text-docs-from-html.patch Push Debian's generation of plain text documents from HTML sources and
installation of both into upstream Makefile rules.

-- Branden Robinson, 2017-03-24T04:45:04-0400
no
debian-stop-clobbering-cflags-and-ldflags.patch Stop clobbering CFLAGS and LDFLAGS, enabling use of Debian's hardening
flags.

Observe LDFLAGS when building internal "compile_rom" tool.

-- Branden Robinson, 2017-04-08T13:29:44-0400
no
mkdisk-document-d-option-in-usage-message.patch Document the -d (directory cylinder number) option in the usage message.

-- Branden Robinson, 2017-04-09T14:59:55-0400
no
fix-stringop-truncation-warning.patch Fix stringop-truncation warning from GCC 8.

* Issue warning diagnostic if the argument to -p is too long.
* Swap order of space-padding strncat and forced setting of pdsbuf[8] to
a null byte. This persuades GCC that we're ensuring pdsbuf has a
string terminator.
* Use '\0' instead of '\000' as null character escape.

cmddump.c:78:7: warning: ‘strncat’ output truncated copying between 0
and 8 bytes from a string of length 8 [-Wstringop-truncation]
strncat(pdsbuf, " ", 8 - strlen(pdsbuf));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

G. Branden Robinson <g.branden.robinson@gmail.com>
no
stop-mkdisk-from-overflowing-buffers.patch Fix buffer overflow in mkdisk, reported at:
https://bugs.launchpad.net/ubuntu/+source/xtrs/+bug/415432

(The following description is pretty much the patch to the mkdisk man
page, in plain text format.)

Matthew Reed's hard drive image file format contains an eight-character
field for storing the filename of the hard drive image itself. mkdisk
simply uses the given filename as this within-image filename. This
works best if filename specifies a short file name in the current
working directory. Since modern operating systems permit filenames much
longer than eight characters, historically versions of xtrs would
deliberately “spill” the remaining characters of filename into the
reserved structure field following the filename.

There were two problems with the foregoing approach:

* Modern versions of the standard C library such as glibc will detect
the overflow of the destination buffer, emit a lengthy, technical,
frightening diagnostic, and abort the program immediately. mkdisk
itself offered no explanation.

* mkdisk also did not do any checking to see if the filename string copy
might overflow the subsequent buffer, the reserved area.

Now, mkdisk by default writes a truncated (if necessary) copy of
filename to the hard disk image file header; a warning diagnostic is
emitted in that event.

With the -S option, mkdisk simulates the old behavior, up to the end of
the reserved area. In this “spill mode”, a warning diagnostic is
emitted if spillage occurs, and the program aborts with an error if the
filename is too long to fit in the filename and reserved fields
combined.

-- Branden Robinson, 2017-04-09T15:02:00-0400
no
mkdisk-check-fopen-return-with-dmk-images.patch mkdisk did not check the return value of fopen() when opening DMK-format
disk images for writing. Fix that.

-- Branden Robinson, 2017-04-04T10:23:12-0400
no
hex2cmd-idiomatize-manpage.patch Reformat and tweak style of manual page to attempt to more closely
follow the conventions set down in man-pages(7), groff_man(7), and
groff(7).

* Mark up URL with groff's extended man macros UR and UE. These macros
produce actual clickable URLs in grohtml, and maybe someday in gropdf.
* If groff is not the typesetter, copy and define the extended man
macros we use. They are even more permissively licensed than xtrs
itself.
* That leaves the man page proper without an explicit copyright and
license. Declare the former based on changelog history and use Tim
Mann's xtrs license for the latter.
* Add "extra" information to the TH arguments. Base the date on
upstream's SVN keyword, and mark the tool as part of the xtrs suite or
package.
* Add style markup to Name section.
* Retitle "Syntax" section to "Synopsis", which is much, much more
widespread.
* Mark up literal input in bold, variables in italics, and synopsis
syntax itself (such as brackets for optional arguments and ellipses)
in roman.
* Render man page cross-references in bold and roman, not italic and
roman, for the page name and parenthesized section respectively.
* Move the SVN keyword expansion into a *roff source comment.
* Add a *roff comment with a Vim modeline to ease editing.

What I didn't do:

* The man-pages people deprecate "Author"(s) sections, but I'm not
willing to make such a change to upstream.

-- Branden Robinson, 2017-04-29T04:04:51-0400
no
cmddump-idiomatize-manpage.patch Reformat and tweak style of manual page to attempt to more closely
follow the conventions set down in man-pages(7), groff_man(7), and
groff(7).

* Clarify several points of detail after consulting the sources, and
attempt to clarify a couple of concepts for readers not thoroughly
conversant with object file formats of the 1980s (like me).
* Remove my authorship claim of the man page. It's in a source comment
now (see below), which suffices.

* Mark up URL with groff's extended man macros UR and UE. These macros
produce actual clickable URLs in grohtml, and maybe someday in gropdf.
* Mark up the Synopsis (né Syntax) section with groff's extended man
macros OP, SY, and YS, replacing the less-specific "[flags]".
* If groff is not the typesetter, copy and define the extended man
macros we use. They are even more permissively licensed than xtrs
itself.
* That leaves the man page proper without an explicit copyright and
license. Declare the former based on changelog history and use Tim
Mann's xtrs license for the latter.
* Add "extra" information to the TH arguments. Base the date on
upstream's SVN keyword, and mark the tool as part of the xtrs suite or
package.
* Add style markup to Name section.
* Retitle "Syntax" section to "Synopsis", which is much, much more
widespread.
* Mark up literal input in bold, variables in italics, and synopsis
syntax itself (such as brackets for optional arguments and ellipses)
in roman.
* Render man page cross-references in bold and roman, not italic and
roman, for the page name and parenthesized section respectively.
* Move the SVN keyword expansion into a *roff source comment.
* Add a *roff comment with a Vim modeline to ease editing.

What I didn't do:

* The man-pages people deprecate "Author"(s) sections, but I'm not
willing to make such a change to upstream.

-- Branden Robinson, 2017-04-29T04:07:09-0400
no
cassette-idiomatize-manpage.patch Reformat and tweak style of manual page to attempt to more closely
follow the conventions set down in man-pages(7), groff_man(7), and
groff(7).

* Clarify that cassette.sh can be found in the source distribution for
those not reading the man page from there.
* Style: When using numeric or letter literal plurals in prose, apply
quotation marks instead of a pseudo-possessive, to avoid the
"greengrocer's apostrophe" look.
* Write proper names of software products more similarly to their
"official" forms, so far as I can determine.
* Style: Use hyphens in phrasal adjectives (cf. "command-line option"
and ("do this at the command line").
* Direct users to ffmpeg as well as sox for sound file format
conversion, since the former has come to enjoy much greater popularity
over the years.
* Remove my authorship claim of the man page. It's in a source comment
now (see below), which suffices.

* Cherry-pick TP macro definition from groff upstream and (if groff is
the typesetter), use it. This enables multiple font macros to be
used (with \c) in the tag of a paragraph, eliminating the need for any
font escapes in a man page--if one sticks to the fonts supported by
the macro package.
* Mark up URL with groff's extended man macros UR and UE. These macros
produce actual clickable URLs in grohtml, and maybe someday in gropdf.
* If groff is not the typesetter, copy and define the extended man
macros we use. They are even more permissively licensed than xtrs
itself.
* That leaves the man page proper without an explicit copyright and
license. Declare the former based on changelog history and use Tim
Mann's xtrs license for the latter.
* Add "extra" information to the TH arguments. Base the date on
upstream's SVN keyword, and mark the tool as part of the xtrs suite or
package.
* Add style markup to Name section.
* Retitle "Syntax" section to "Synopsis", which is much, much more
widespread.
* Mark up literal input in bold, variables in italics, and synopsis
syntax itself (such as brackets for optional arguments and ellipses)
in roman.
* Mark up literal filespec references in italics.
* Use subsections instead of tagged paragraphs where that seems to be
the intention.
* Use the idiomatic method (per groff_man(7)) to get multiple paragraphs
under one tag.
* Use *roff character escapes for directional quotes when used as prose
quotation marks (contra programming-language quotation marks).
* Eliminate completely blank source lines.
* Break source lines at sentence endings.
* Render man page cross-references in bold and roman, not italic and
roman, for the page name and parenthesized section respectively.
* Move the SVN keyword expansion into a *roff source comment.
* Add a *roff comment with a Vim modeline to ease editing.

What I didn't do:

* The man-pages people deprecate "Author"(s) sections, but I'm not
willing to make such a change to upstream.

-- Branden Robinson, 2017-04-29T03:58:47-0400
no
debian-cassette-manpage-del-paragraph.patch Drop paragraph made inaccurate by the fact that Debian ships only the
POSIX-shell form of the cassette script.

The bulk of the patch to cassette.txt is the result of lines being
filled from left vs. the right, because the paragraph-deleting patch
changed the parity of the line count after that point.

-- Branden Robinson, 2018-08-08T08:14:21-0400
no
mkdisk-idiomatize-manpage.patch Reformat and tweak style of manual page to attempt to more closely
follow the conventions set down in man-pages(7), groff_man(7), and
groff(7).

* Document the -d flag (in -h mode) in the synopsis.
* Style: Use hyphens in phrasal adjectives (cf. "command-line option"
and ("do this at the command line").
* Style: Use "k", not "K", as the metric prefix for "kilo".
* Style: Use IEC "metric binary" prefixes--grudgingly.
* Comment out some outdated material about releases of David Keil's
emulator.
* Correct reference to origin of the ReedHardHeader struct; at some
point it was moved to reed.h from mkdisk.c.

* Introduce macros to render floppy diskette size fractions (5¼ and 3½).
Since glyphs for these common fractions are supported on every *roff
output device except "ascii", use them. However, they degrade badly
in the ASCII case (51/4 and 31/2, which are confusing and numerically
wrong), so render them as decimals in that case.

* Mark up URL with groff's extended man macros UR and UE. These macros
produce actual clickable URLs in grohtml, and maybe someday in gropdf.
* Mark up the Synopsis (né Syntax) section with groff's extended man
macros OP, SY, and YS, replacing the less-specific "[flags]".
* Mark up examples with groff's extended man macros EX and EE.
* If groff is not the typesetter, copy and define the extended man
macros we use. They are even more permissively licensed than xtrs
itself.
* That leaves the man page proper without an explicit copyright and
license. Declare the former based on changelog history and use Tim
Mann's xtrs license for the latter.
* Push several top-level sections to subsections of the Description
section.
* Add "extra" information to the TH arguments. Base the date on
upstream's SVN keyword, and mark the tool as part of the xtrs suite or
package.
* Add style markup to Name section.
* Retitle "Syntax" section to "Synopsis", which is much, much more
widespread.
* Use EX/EE macros to bracket the copy of reed.h. This makes it look
nice in all output formats.
* Use .ne ("need") requests to keep the ReedHardHeader struct fields
from getting broken across pages.
* Reflow (the copy of) reed.h so its lines will fit on an 80-column
terminal.
* Reference (and, if outputting HTML, link to) the "dskspec" document by
its title, not just its filename.
* Mark up literal input in bold, variables in italics, and synopsis
syntax itself (such as brackets for optional arguments and ellipses)
in roman.
* Mark up literal filespec references in italics.
* Use *roff character escapes for directional quotes when used as prose
quotation marks (contra programming-language quotation marks).
* Eliminate completely blank source lines.
* Break source lines at sentence endings.
* Mark up names of software products in italics (cf. the topic of the
current man page or a man page cross-reference, see next item).
* Render man page cross-references in bold and roman, not italic and
roman, for the page name and parenthesized section respectively.
* Move the SVN keyword expansion into a *roff source comment.
* Add a *roff comment with a Vim modeline to ease editing.

What I didn't do:

* The man-pages people deprecate "Author"(s) sections, but I'm not
willing to make such a change to upstream.

-- Branden Robinson, 2017-04-29T04:16:25-0400
no
xtrs-idiomatize-manpage.patch Reformat and tweak style of manual page to attempt to more closely
follow the conventions set down in man-pages(7), groff_man(7), and
groff(7).

Make many minor clarifications, comment-out dead Web links, and so
forth. It's less than a rewrite, more than a minor editing pass.

* Offer the reader a 1,000-foot view of what xtrs actually is.
* Update language in places to reflect that not every host for xtrs
is a "PC". This affects mainly discussions of PC-style keyboards
with their numeric keypads, and floppy disk controllers on (real or
southbridge-emulated) ISA buses.
* Update X keyboard-related material. xmodmap is pretty strongly
deprecated these days, at least for mucking about with key mappings.
Also, despite XKB's lack of coherent, centralized, and accessible
documentation, most *nix distributors seem to get NumLock straight
these days.
* Update discussion of emulator tick timing since the Linux kernel has
undergone a lot of change in this area.
* Note which tools on utility.dsk are affected by the -emtsafe option.
* Update real-time clock discussion. LDOS's year-2012 bug has arrived
en force.
* Inform bold readers where to find information on X resource syntax.
* Add "Exit status", "Environment", and "Files" sections.
* Incorporate "Additional resources" section into new "See also"
section.

* Clarify that various files can be found in the source distribution for
those not reading the man page from there.
* Style: When using numeric or letter literal plurals in prose, apply
quotation marks instead of a pseudo-possessive, or recast the
sentence, to avoid the "greengrocer's apostrophe" look.
* Style: "tty" -> "terminal" [man-pages(7)]
* Style: Render "Z-80" as "Z80" since that seems to be Zilog's
preferred convention.
* Style: Use hyphens in phrasal adjectives (cf. "command-line option"
and ("do this at the command line").
* Style: Use "k", not "K", as the metric prefix for "kilo".
* Style: Use IEC "metric binary" prefixes--grudgingly--in contemporary
contexts; but do _not_ thus update references to how historical floppy
drives and diskettes were marketed and labeled.
* Style: "current directory" -> "current working directory", as that's
the Unix parlance.
* Style: "{lower,upper} case" -> "{lowercase,uppercase}"
* Introduce abbreviations like "OSS" in prose.

* Introduce macros to render floppy diskette size fractions (5¼ and 3½).
Since glyphs for these common fractions are supported on every *roff
output device except "ascii", use them. However, they degrade badly
in the ASCII case (51/4 and 31/2, which are confusing and numerically
wrong), so render them as decimals in that case.
* Introduce macros to render the umlaut and ess-tsett ("sharp s")
symbols as such on every output device except "ascii". Fall back
gracefully for ASCII.

* Mark up URL with groff's extended man macros UR and UE. These macros
produce actual clickable URLs in grohtml, and maybe someday in gropdf.
* Mark up the Synopsis (né Syntax) section with groff's extended man
macros OP, SY, and YS, replacing the less-specific "[flags]".
* However, xtrs has so _many_ options that this seemed unhelpful for the
full smorgasbord of 'em; so leave the synopsis with just the
(near-?)essentials of model number and disk image directory.
* Mark up examples with groff's extended man macros EX and EE.
* Mark up tagged paragraph continuations with groff's extended man macro
TQ.
* If groff is not the typesetter, copy and define the extended man
macros we use. They are even more permissively licensed than xtrs
itself.
* That leaves the man page proper without an explicit copyright and
license. Declare the former based on changelog history and use Tim
Mann's xtrs license for the latter.
+ *** NOTE *** I reviewed the xtrs 1.0 version of the man page and
feel that Tim so comprehensively rewrote and expanded
it that it's not worth the trouble trying to extract a
few phrases here and there to mark them with the
Clarendon Hill Software copyright statement and
license.
* Push several top-level sections to subsections of the Description
section.
* Add "extra" information to the TH arguments. Base the date on
upstream's SVN keyword, and mark the tool as part of the xtrs suite or
package.
* Retitle "Syntax" section to "Synopsis", which is much, much more
widespread.
* Use EX/EE macros to bracket the copy of reed.h. This makes it look
nice in all output formats.
* Use .ne ("need") requests to keep the ReedHardHeader struct fields
from getting broken across pages.
* Reflow (the copy of) reed.h so its lines will fit on an 80-column
terminal.
* Reference (and, if outputting HTML, link to) the "dskspec" document by
its title, not just its filename.
* Mark up literal input in bold, variables in italics, and synopsis
syntax itself (such as brackets for optional arguments and ellipses)
in roman.
* Mark up literal filespec references in italics.
* Mark up host machine keycaps in bold.
* Use *roff character escapes for directional quotes when used as prose
quotation marks (contra programming-language quotation marks).
* Use *roff character escapes for literal backslashes, and "spacing"
carets ("circumflex accents") and tildes ("tilde accents", sometimes
called "swung dashes" when spacing).
* Use multiplication and division signs rather than C operators.
* Use *roff character escapes for em-dashes and en-dashes.
* Eliminate completely blank source lines.
* Break source lines at sentence endings.
* Mark up names of software products in italics (cf. the topic of the
current man page or a man page cross-reference, see next item). It
was hard to find an authoritative source for NEWDOS/80, though.
* Render man page cross-references in bold and roman, not italic and
roman, for the page name and parenthesized section respectively.
* Move the SVN keyword expansion into a *roff source comment.
* Add a *roff comment with a Vim modeline to ease editing.

What I didn't do:

* The man-pages people deprecate "Author"(s) sections, but I'm not
willing to make such a change to upstream.

--Branden Robinson, 2017-04-30T19:06:12-0400
no
makefile-generate-pdf-manpages.patch Generate and install PDF versions of man pages.

-- Branden Robinson, 2017-04-16T14:38:52-0400
no
emtsafe-flag-on-by-default.patch Enable the emtsafe flag by default and document this.

-- Branden Robinson, 2017-04-16T14:57:29-0400
no
ignore-alt-key-events.patch Don't catch Alt_L or Alt_R key events, since lots of window managers use
them.

-- Branden Robinson, 2017-03-24T02:54:38-0400
no
map-f12-to-shifted-down-arrow.patch Map F12 to the TRS-80 shifted down-arrow key.

In stock xtrs, RightAlt was used for this, but:
* Lots of modern window managers use Alt keys for task-switching; and
* Lots of non-U.S. users use RightAlt for AltGr.

Also, it's easier to find an F12 key than a RightAlt key on many
truncated laptop keyboards these days.

Turn off SHIFT_F1_IS_F13 #define; that seems to not be true for modern
Xorg per modern Xorg's xev(1).

Add comment noting that F7 through F11 (inclusive) are not available for
TRS-80 key bindings due to early interpretation in trs_xinterface.c.

Document this key binding in the man page.

Sync in-tree but generated plain-text version of man page.

-- Branden Robinson, 2018-08-08T02:56:19-0400
no
write-online-help-to-stderr-if-small-window.patch Write online key binding help to stderr if the parent X window is too
small or if the font used to render the help text cannot be opened.

Add a private (static) helper function to perform the writes to stderr
so that code isn't duplicated.

Use error.c:error() instead of fprintf(stderr, ...) for diagnostics.

Add const markers to unmodified variables in the help code.

Hoist a variable declaration out of a loop.

-- Branden Robinson, 2017-04-17T13:40:04-0400
no
kill-last-fprintf-stderr-stragglers.patch Convert only remaining uses of fprintf(stderr, ...) in xtrs to use the
functions in error.c instead.

Upstream may prefer to simply migrate an error from XOpenDisplay() to
fatal(); my approach preserves the unique exit status of this situation.

-- Branden Robinson, 2017-04-17T01:43:21-0400
no

All known versions for source package 'xtrs'

Links