public inbox for gdb-testers@sourceware.org help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net To: gdb-testers@sourceware.org Subject: [binutils-gdb] Handle CRLF when reading XML on Windows Date: Thu, 19 Dec 2019 17:28:00 -0000 [thread overview] Message-ID: <f69656d00fe3154519ea21668d964bf8cc50c01b@gdb-build> (raw) *** TEST RESULTS FOR COMMIT f69656d00fe3154519ea21668d964bf8cc50c01b *** commit f69656d00fe3154519ea21668d964bf8cc50c01b Author: Tom Tromey <tromey@adacore.com> AuthorDate: Tue Dec 10 11:44:36 2019 -0700 Commit: Tom Tromey <tromey@adacore.com> CommitDate: Thu Dec 19 10:00:05 2019 -0700 Handle CRLF when reading XML on Windows xml-support.c uses FOPEN_RT, but then reads the entire contents of the file and verifies that the number of bytes read matches the length. This can fail on Windows, where the read will translate line terminators. This patch fixes the bug by changing xml-support.c to use FOPEN_RB. This works because expat correctly handles \r\n line terminators. gdb/ChangeLog 2019-12-11 Tom Tromey <tromey@adacore.com> * xml-support.c (xml_fetch_content_from_file): Use FOPEN_RB. gdb/testsuite/ChangeLog 2019-12-11 Tom Tromey <tromey@adacore.com> * gdb.xml/tdesc-arch.exp (set_arch): Add "trans_mode" parameter. Add crlf test. Change-Id: I548438f33eed284dde1de8babf755eaa1a40319d diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8e38ada5ea..532dc6373a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2019-12-11 Tom Tromey <tromey@adacore.com> + + * xml-support.c (xml_fetch_content_from_file): Use FOPEN_RB. + 2019-12-18 Tom Tromey <tromey@adacore.com> PR build/25268: diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1079e71c84..4f8d8517e3 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-12-11 Tom Tromey <tromey@adacore.com> + + * gdb.xml/tdesc-arch.exp (set_arch): Add "trans_mode" parameter. + Add crlf test. + 2019-12-18 Simon Marchi <simon.marchi@efficios.com> * gdb.base/default.exp: Update value of $_gdb_major. diff --git a/gdb/testsuite/gdb.xml/tdesc-arch.exp b/gdb/testsuite/gdb.xml/tdesc-arch.exp index 617ab0616b..d98e50e562 100644 --- a/gdb/testsuite/gdb.xml/tdesc-arch.exp +++ b/gdb/testsuite/gdb.xml/tdesc-arch.exp @@ -55,13 +55,16 @@ if { "$arch1" == "" || "$arch2" == "" || "$default_arch" == "" } { # Run these tests twice, once for $arch1 and once for $arch2, to # make sure that the tdesc file overrides the global default. +# TRANS_MODE indicates how newlines should be represented; it should +# be one of the values supported by "fconfigure -translation". -proc set_arch { arch which } { +proc set_arch { arch which trans_mode } { global gdb_prompt global subdir set filename [standard_output_file tdesc-arch.xml] set fd [open $filename w] + fconfigure $fd -translation $trans_mode puts $fd \ "<target> <architecture>$arch</architecture> @@ -92,8 +95,13 @@ proc set_arch { arch which } { remote_file host delete $filename } -set_arch $arch1 first -set_arch $arch2 second +set_arch $arch1 first lf +set_arch $arch2 second lf + +with_test_prefix crlf { + set_arch $arch1 first crlf + set_arch $arch2 second crlf +} # Check an invalid architecture setting. set filename [standard_output_file tdesc-arch.xml] diff --git a/gdb/xml-support.c b/gdb/xml-support.c index f5a1427545..0f0806f8ee 100644 --- a/gdb/xml-support.c +++ b/gdb/xml-support.c @@ -977,11 +977,11 @@ xml_fetch_content_from_file (const char *filename, void *baton) { char *fullname = concat (dirname, "/", filename, (char *) NULL); - file = gdb_fopen_cloexec (fullname, FOPEN_RT); + file = gdb_fopen_cloexec (fullname, FOPEN_RB); xfree (fullname); } else - file = gdb_fopen_cloexec (filename, FOPEN_RT); + file = gdb_fopen_cloexec (filename, FOPEN_RB); if (file == NULL) return {};
next reply other threads:[~2019-12-19 17:23 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-19 17:28 gdb-buildbot [this message] 2019-12-19 17:23 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, branch master gdb-buildbot 2019-12-19 17:44 ` Failures on Ubuntu-Aarch64-m64, " gdb-buildbot 2019-12-19 17:59 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot 2019-12-20 17:23 ` Failures on Fedora-x86_64-m32, " gdb-buildbot 2019-12-20 17:52 ` Failures on Fedora-i686, " gdb-buildbot 2019-12-20 18:11 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot 2019-12-20 18:16 ` Failures on Fedora-x86_64-m64, " gdb-buildbot 2019-12-20 18:20 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot 2019-12-20 18:39 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot 2019-12-20 18:47 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot 2019-12-20 19:10 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot
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 * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=f69656d00fe3154519ea21668d964bf8cc50c01b@gdb-build \ --to=gdb-buildbot@sergiodj.net \ --cc=gdb-testers@sourceware.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).