Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [COMMIT] Accept "\r\n" line-endings on all hosts
@ 2004-10-14 12:44 Mark Kettenis
  2004-10-14 13:47 ` Andrew Cagney
  0 siblings, 1 reply; 11+ messages in thread
From: Mark Kettenis @ 2004-10-14 12:44 UTC (permalink / raw)
  To: gdb-patches

In the discussion about elimination of the Cygwin and DJGPP xm.h files
we seemed to have reached agreement on this.  Actually this is a real
improvement, since it will allow you to execute scripts copied from a
system using the MS-DOS convention without converting them.

Tested on i386-unknown-freebsd4.7.

Mark

Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* top.c (gdb_readline): Always accept "\r\n" as a line-ending.
	* event-top.c (gdb_readline2): Likewise.

Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.93
diff -u -p -r1.93 top.c
--- top.c 13 Sep 2004 18:26:30 -0000 1.93
+++ top.c 14 Oct 2004 12:30:25 -0000
@@ -932,15 +932,11 @@ gdb_readline (char *prompt_arg)
 	}
 
       if (c == '\n')
-#ifndef CRLF_SOURCE_FILES
-	break;
-#else
 	{
 	  if (input_index > 0 && result[input_index - 1] == '\r')
 	    input_index--;
 	  break;
 	}
-#endif
 
       result[input_index++] = c;
       while (input_index >= result_size)
Index: event-top.c
===================================================================
RCS file: /cvs/src/src/gdb/event-top.c,v
retrieving revision 1.34
diff -u -p -r1.34 event-top.c
--- event-top.c 13 Sep 2004 18:26:28 -0000 1.34
+++ event-top.c 14 Oct 2004 12:30:27 -0000
@@ -855,15 +855,11 @@ gdb_readline2 (gdb_client_data client_da
 	}
 
       if (c == '\n')
-#ifndef CRLF_SOURCE_FILES
-	break;
-#else
 	{
 	  if (input_index > 0 && result[input_index - 1] == '\r')
 	    input_index--;
 	  break;
 	}
-#endif
 
       result[input_index++] = c;
       while (input_index >= result_size)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [COMMIT] Accept "\r\n" line-endings on all hosts
  2004-10-14 12:44 [COMMIT] Accept "\r\n" line-endings on all hosts Mark Kettenis
@ 2004-10-14 13:47 ` Andrew Cagney
  2004-10-14 18:37   ` Mark Kettenis
  0 siblings, 1 reply; 11+ messages in thread
From: Andrew Cagney @ 2004-10-14 13:47 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

> In the discussion about elimination of the Cygwin and DJGPP xm.h files
> we seemed to have reached agreement on this.  Actually this is a real
> improvement, since it will allow you to execute scripts copied from a
> system using the MS-DOS convention without converting them.

Can this be tested?  A one line uuencoded script comes to mind.

> Tested on i386-unknown-freebsd4.7.

(you mean no regressions :-)

Andrew



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [COMMIT] Accept "\r\n" line-endings on all hosts
  2004-10-14 13:47 ` Andrew Cagney
@ 2004-10-14 18:37   ` Mark Kettenis
  2004-10-14 19:09     ` Andrew Cagney
  2004-10-14 21:11     ` Eli Zaretskii
  0 siblings, 2 replies; 11+ messages in thread
From: Mark Kettenis @ 2004-10-14 18:37 UTC (permalink / raw)
  To: cagney; +Cc: gdb-patches

   Date: Thu, 14 Oct 2004 09:47:11 -0400
   From: Andrew Cagney <cagney@gnu.org>

   > In the discussion about elimination of the Cygwin and DJGPP xm.h files
   > we seemed to have reached agreement on this.  Actually this is a real
   > improvement, since it will allow you to execute scripts copied from a
   > system using the MS-DOS convention without converting them.

   Can this be tested?  A one line uuencoded script comes to mind.

Yup should be doable.  No uuencoding necessary I think.  Unless CVS
silently changes \r\n into \n.

Mark


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [COMMIT] Accept "\r\n" line-endings on all hosts
  2004-10-14 18:37   ` Mark Kettenis
@ 2004-10-14 19:09     ` Andrew Cagney
  2004-10-14 19:48       ` Mark Kettenis
  2004-10-14 21:11     ` Eli Zaretskii
  1 sibling, 1 reply; 11+ messages in thread
From: Andrew Cagney @ 2004-10-14 19:09 UTC (permalink / raw)
  To: Mark Kettenis, Michael Elizabeth Chastain; +Cc: gdb-patches

>    Date: Thu, 14 Oct 2004 09:47:11 -0400
>    From: Andrew Cagney <cagney@gnu.org>
> 
>    > In the discussion about elimination of the Cygwin and DJGPP xm.h files
>    > we seemed to have reached agreement on this.  Actually this is a real
>    > improvement, since it will allow you to execute scripts copied from a
>    > system using the MS-DOS convention without converting them.
> 
>    Can this be tested?  A one line uuencoded script comes to mind.
> 
> Yup should be doable.  No uuencoding necessary I think.  Unless CVS
> silently changes \r\n into \n.

I suspect, dependant on how the file is created in CVS, that: UNIX ci; 
dos co; dos tweak; dos ci; UNIX co; might do it.

I was actually more worried by human error.  I suspect a few lines of 
tcl that just generate the file are easiest.

Andrew



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [COMMIT] Accept "\r\n" line-endings on all hosts
  2004-10-14 19:09     ` Andrew Cagney
@ 2004-10-14 19:48       ` Mark Kettenis
  2004-10-14 19:59         ` Andrew Cagney
  2004-10-15  2:16         ` Michael Chastain
  0 siblings, 2 replies; 11+ messages in thread
From: Mark Kettenis @ 2004-10-14 19:48 UTC (permalink / raw)
  To: cagney; +Cc: mec.gnu, gdb-patches

   Date: Thu, 14 Oct 2004 15:09:20 -0400
   From: Andrew Cagney <cagney@gnu.org>

   I was actually more worried by human error.  I suspect a few lines of 
   tcl that just generate the file are easiest.

The attached seems to work on i386-unknown-freebsd4.7.  OK Michael?

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* gdb.base/crlf.exp: New file.

--- /dev/null	Thu Oct 14 21:44:00 2004
+++ gdb.base/crlf.exp	Thu Oct 14 21:42:51 2004
@@ -0,0 +1,45 @@
+# Copyright 2004 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@gnu.org
+
+# This file is part of the gdb testsuite.
+
+if $tracelevel {
+    strace $tracelevel
+}
+
+# Test whether we can execute command files with \r\n line-endings.
+
+set prms_id 0
+set bug_id 0
+
+set file [open "crlf.gdb" "w"]
+puts -nonewline $file "info break\r\n"
+close $file
+
+set cmdfile [remote_download host "crlf.gdb"]
+
+gdb_exit
+gdb_start
+
+gdb_test "source $cmdfile" \
+	"No breakpoints or watchpoints." \
+	"execute command file"
+
+remote_file build delete "crlf.gdb"
+remote_file host delete $cmdfile


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [COMMIT] Accept "\r\n" line-endings on all hosts
  2004-10-14 19:48       ` Mark Kettenis
@ 2004-10-14 19:59         ` Andrew Cagney
  2004-10-15  2:16         ` Michael Chastain
  1 sibling, 0 replies; 11+ messages in thread
From: Andrew Cagney @ 2004-10-14 19:59 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: mec.gnu, gdb-patches

+set file [open "crlf.gdb" "w"]
+puts -nonewline $file "info break\r\n"
+close $file

yes, like it, recommended, thanks!


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [COMMIT] Accept "\r\n" line-endings on all hosts
  2004-10-14 18:37   ` Mark Kettenis
  2004-10-14 19:09     ` Andrew Cagney
@ 2004-10-14 21:11     ` Eli Zaretskii
  2004-10-14 23:03       ` Andreas Schwab
  1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2004-10-14 21:11 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: cagney, gdb-patches

> Date: Thu, 14 Oct 2004 20:37:19 +0200 (CEST)
> From: Mark Kettenis <mark.kettenis@xs4all.nl>
> CC: gdb-patches@sources.redhat.com
> 
> Yup should be doable.  No uuencoding necessary I think.  Unless CVS
> silently changes \r\n into \n.

Some Windows CVS clients do that.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [COMMIT] Accept "\r\n" line-endings on all hosts
  2004-10-14 21:11     ` Eli Zaretskii
@ 2004-10-14 23:03       ` Andreas Schwab
  2004-10-15 12:43         ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Schwab @ 2004-10-14 23:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Mark Kettenis, cagney, gdb-patches

"Eli Zaretskii" <eliz@gnu.org> writes:

>> Date: Thu, 14 Oct 2004 20:37:19 +0200 (CEST)
>> From: Mark Kettenis <mark.kettenis@xs4all.nl>
>> CC: gdb-patches@sources.redhat.com
>> 
>> Yup should be doable.  No uuencoding necessary I think.  Unless CVS
>> silently changes \r\n into \n.
>
> Some Windows CVS clients do that.

Unless you mark the file as binary (-kb).

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [COMMIT] Accept "\r\n" line-endings on all hosts
  2004-10-14 19:48       ` Mark Kettenis
  2004-10-14 19:59         ` Andrew Cagney
@ 2004-10-15  2:16         ` Michael Chastain
  1 sibling, 0 replies; 11+ messages in thread
From: Michael Chastain @ 2004-10-15  2:16 UTC (permalink / raw)
  To: kettenis, cagney; +Cc: gdb-patches

Hi Mark,

A good idea, but a few corrections please.  

  # Please email any bugs, comments, and/or additions to this file to:
  # bug-gdb@gnu.org

    Drop this part.

  set file [open "crlf.gdb" "w"]
  puts -nonewline $file "info break\r\n"
  close $file

    Usually I would prefer to have crlf.gdb be a static file.
    In view of the critical nature of the "\r\n" part, I agree with
    Andrew's analysis, doing this in TCL is safer than relying on
    cvs to preserve the line endings.

    But it needs error checking on the statements with external
    effect, especially "open".

  remote_file build delete "crlf.gdb"
  remote_file host delete $cmdfile

    Drop these.  It's good to leave small files lying around after a
    test -- makes it easier to debug if anything goes wrong.

	* gdb.base/crlf.exp: New file.

Michael


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [COMMIT] Accept "\r\n" line-endings on all hosts
  2004-10-14 23:03       ` Andreas Schwab
@ 2004-10-15 12:43         ` Eli Zaretskii
  2004-10-15 13:48           ` Andreas Schwab
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2004-10-15 12:43 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: mark.kettenis, cagney, gdb-patches

> Cc: Mark Kettenis <mark.kettenis@xs4all.nl>, cagney@gnu.org,
> 	gdb-patches@sources.redhat.com
> From: Andreas Schwab <schwab@suse.de>
> Date: Fri, 15 Oct 2004 01:00:05 +0200
> 
> >> Yup should be doable.  No uuencoding necessary I think.  Unless CVS
> >> silently changes \r\n into \n.
> >
> > Some Windows CVS clients do that.
> 
> Unless you mark the file as binary (-kb).

And lose important features like diffs, per-line annotations, etc.
No, thanks.

People who port CVS clients to Windows should really do a better job.
Until they do, DJGPP's dtou.exe and utod.exe rule!


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [COMMIT] Accept "\r\n" line-endings on all hosts
  2004-10-15 12:43         ` Eli Zaretskii
@ 2004-10-15 13:48           ` Andreas Schwab
  0 siblings, 0 replies; 11+ messages in thread
From: Andreas Schwab @ 2004-10-15 13:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: mark.kettenis, cagney, gdb-patches

"Eli Zaretskii" <eliz@gnu.org> writes:

>> Cc: Mark Kettenis <mark.kettenis@xs4all.nl>, cagney@gnu.org,
>> 	gdb-patches@sources.redhat.com
>> From: Andreas Schwab <schwab@suse.de>
>> Date: Fri, 15 Oct 2004 01:00:05 +0200
>> 
>> >> Yup should be doable.  No uuencoding necessary I think.  Unless CVS
>> >> silently changes \r\n into \n.
>> >
>> > Some Windows CVS clients do that.
>> 
>> Unless you mark the file as binary (-kb).
>
> And lose important features like diffs, per-line annotations, etc.
> No, thanks.

For a single small file just for testing purpose that should not pose much
problem.  Otherwise I agree.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-10-15 13:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-14 12:44 [COMMIT] Accept "\r\n" line-endings on all hosts Mark Kettenis
2004-10-14 13:47 ` Andrew Cagney
2004-10-14 18:37   ` Mark Kettenis
2004-10-14 19:09     ` Andrew Cagney
2004-10-14 19:48       ` Mark Kettenis
2004-10-14 19:59         ` Andrew Cagney
2004-10-15  2:16         ` Michael Chastain
2004-10-14 21:11     ` Eli Zaretskii
2004-10-14 23:03       ` Andreas Schwab
2004-10-15 12:43         ` Eli Zaretskii
2004-10-15 13:48           ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox