bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #55334] preconv fails when build with libuchardet on MS-Windows


From: Ingo Schwarze
Subject: [bug #55334] preconv fails when build with libuchardet on MS-Windows
Date: Sun, 18 Oct 2020 09:37:31 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; OpenBSD amd64; rv:81.0) Gecko/20100101 Firefox/81.0

Follow-up Comment #13, bug #55334 (project groff):

Thanks for fixing this!

I would like to raise a minor concern, maybe you can tweak your solution. 
Comparing the filename to "-" seems fragile.  There may be other ways to get a
non-seekable file descriptor, for example someone passing "/dev/stdin" on the
command line or someone passing the name of a file created with mkfifo(1).

Instead of strcmp(filename, "-") in do_file(), i suggest doing something like
the following inside detect_file_encoding():

-rewind(fp);
+if (fseek(fp, 0L, SEEK_SET) == -1)
+    goto end;

That seems like the canonical way to test for the feature actually needed,
which feels much more robust than some crude guesswork based on tangentially
related string data.  Testing at the place where the feature is really needed
(and where other error handling is already present) also seems easier to
understand than having an additional check one level up in the call stack.

What do you think?

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55334>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]