From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 18006@debbugs.gnu.org
Subject: bug#18006: Simplify via set_binary_mode
Date: Tue, 15 Jul 2014 17:37:40 +0300 [thread overview]
Message-ID: <83egxm8z7v.fsf@gnu.org> (raw)
In-Reply-To: <53C43A86.4070303@cs.ucla.edu>
> Date: Mon, 14 Jul 2014 13:16:06 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: 18006@debbugs.gnu.org
>
> Your explanation of _fmode led me to find a minor porting bug.
> Fx_load_color_file [!HAVE_X_WINDOWS] uses fopen with "rt"; unlike "rb"
> this isn't specified by POSIX and a web search suggests that it does
> fail on a few older platforms. Emacs no longer modifies _fmode so "r"
> should suffice now anyway. Also, there are two other places where some
> "rt"-related simplifications can be done. Proposed further patch attached.
Thanks. The lib-src part looks OK to me.
> --- src/ChangeLog 2014-07-14 19:23:18 +0000
> +++ src/ChangeLog 2014-07-14 19:46:54 +0000
> @@ -1,5 +1,10 @@
> 2014-07-14 Paul Eggert <eggert@cs.ucla.edu>
>
> + Use "b" flag more consistently; avoid "t" (Bug#18006).
> + * lread.c (Fload) [DOS_NT]:
> + * xfaces.c (Fx_load_color_file) [!HAVE_X_WINDOWS]:
> + No longer need to use "rt" instead of "r".
This part doesn't look right. If we don't use "rt", then when
emacs_fopen calls emacs_open, the latter will interpret the lack of
"t" as a sign to use the default binary mode, which is not what we
want.
I think we can fix this in one of 2 ways: either (a) let emacs_fopen
start with O_TEXT in bmode by default, at least on DOS_NT platforms;
or (b) change emacs_open back to not apply O_BINARY by default, and
instead use "rb", "wb", and O_BINARY in all the places except those
that use "rt" or "wt" now.
I like the latter alternative better, because the former makes
emacs_fopen and emacs_open use 2 different defaults (text vs binary),
which is contrary to intuition and easy to forget.
WDYT?
next prev parent reply other threads:[~2014-07-15 14:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-12 20:52 bug#18006: Simplify via set_binary_mode Paul Eggert
2014-07-13 4:20 ` Eli Zaretskii
2014-07-13 5:28 ` Paul Eggert
2014-07-13 15:02 ` Eli Zaretskii
2014-07-14 2:11 ` Paul Eggert
2014-07-14 15:21 ` Eli Zaretskii
2014-07-14 20:16 ` Paul Eggert
2014-07-15 14:37 ` Eli Zaretskii [this message]
2014-07-15 19:39 ` Paul Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83egxm8z7v.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=18006@debbugs.gnu.org \
--cc=eggert@cs.ucla.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).