Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [commit/obv] Remove trailing space in gdbarch.sh.
Date: Wed, 12 Dec 2012 15:33:00 -0000	[thread overview]
Message-ID: <50C8A3CD.3000608@redhat.com> (raw)
In-Reply-To: <1355320564-6481-1-git-send-email-brobecker@adacore.com>

On 12/12/2012 01:56 PM, Joel Brobecker wrote:
> Hello,
> 
> I noticed this trailing space when I ran an unmodified gdbarch.sh,
> and yet got a difference in gdbarch.h!  Fixed in gdbarch.sh.

I don't see such a difference, but the patch is of course fine.

git blame on the corresponding line on gdbarch.h points at:

Author: Joel Brobecker <brobecker@gnat.com>
Date:   Wed Oct 26 21:23:54 2011 +0000

    Regenerate gdbarch.h
    
    Not sure why, but the version currently checked in as an extraneous
    trailing whitespace that showed up as a diff when I reran gdbarch.sh.
    
    gdb/ChangeLog:
    
            * gdbarch.h: Regenerate.

:-)

I'm going to guess that you've been switching between systems, and
on some of those /bin/sh is bash while on others its dash
(most likely the latter is Ubuntu).

Regenerating gdbarch.h from scratch with bash always ends up with
that whitespace stripped for me.  If I run 'dash ./gdbarch.sh'
then indeed I see the extra space ending on up gdbarch.h.

"read" trims leading and trailing whitespace by default (on bash at least).  We
can make it not do that by setting the IFS variable to empty, like in the
patch below.  This should make it so that all shells behave the same
here (tried bash and dash), which I think would be good.

WDYT?

2012-12-12  Pedro Alves  <palves@redhat.com>

	* gdbarch.sh (do_read): Set IFS to blank.
---

 gdb/gdbarch.sh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 81a70b0..7433378 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -47,7 +47,7 @@ do_read ()
 {
     comment=""
     class=""
-    while read line
+    while IFS='' read line
     do
 	if test "${line}" = ""
 	then


  reply	other threads:[~2012-12-12 15:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-12 13:56 Joel Brobecker
2012-12-12 15:33 ` Pedro Alves [this message]
2012-12-12 15:46   ` Tom Tromey
2012-12-13  5:47   ` Joel Brobecker
2012-12-13 10:32     ` Pedro Alves

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=50C8A3CD.3000608@redhat.com \
    --to=palves@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@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: link
Be 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