Date: Fri, 12 Nov 2004 00:04:18 EST-10EDT,10,-1,0,7200,3,-1,0,7200,3600 Subject: [UnixOS2_Archive] No. 445 ************************************************** Thursday 11 November 2004 Number 445 ************************************************** Subjects for today 1 Re: \n conversion with TR : John Poltorak 2 Re: \n conversion with TR : Stefan.Neis at t-online.de 3 Re: Debugging tar : Stefan.Neis at t-online.de 4 Re: \n conversion with TR : Stefan.Neis at t-online.de 5 Re: Debugging tar : Dave Yeo" 6 Re: Debugging tar : John Poltorak 7 Re: \n conversion with TR : John Poltorak 8 Re: \n conversion with TR : Knut St. Osmundsen" 9 Re: \n conversion with TR : Thomas Dickey 10 Re: Debugging tar : Stefan.Neis at t-online.de 11 Re: Debugging tar : Steven Levine" 12 Re: Debugging tar : John Poltorak 13 Re: Debugging tar : Stefan.Neis at t-online.de 14 Re: Debugging tar : Yuri Dario" 15 Re: Debugging tar : John Poltorak 16 Re: Debugging tar : John Poltorak **= Email 1 ==========================** Date: Wed, 10 Nov 2004 13:37:56 +0000 From: John Poltorak Subject: Re: \n conversion with TR On Wed, Nov 10, 2004 at 02:22:33PM +0100, Stefan.Neis at t-online.de wrote: > Rather sounds like a job for "sed" (maybe something like > sed "s/\n/\r\n/" or sed "s/$/\r/" or similar). Good suggestion! This works:- sed "s/$//" foo >foo.tmp Don't ask me to explain why it works :-)... > BTW, is there anything (except for REXX scripts and config.sys) which > really inisist on having CRLF? It's a REXX script in a tarball that I wish to convert. > Regards, > Stefan > > -- John **= Email 2 ==========================** Date: Wed, 10 Nov 2004 14:22:33 +0100 From: Stefan.Neis at t-online.de Subject: Re: \n conversion with TR Hi, > Is it possible to convert Unix newlines to CRLF using TR > from the GNU Text Utilities? I don't think so. The opposite directions (removing CR - "tr -d \r" or "tr -d \\r" - depending on the shell - should normally do). should be relatively easy, but replacing one character by a sequence of two characters doesn't seem to be something which tr was made for. Rather sounds like a job for "sed" (maybe something like sed "s/\n/\r\n/" or sed "s/$/\r/" or similar). BTW, is there anything (except for REXX scripts and config.sys) which really inisist on having CRLF? Regards, Stefan **= Email 3 ==========================** Date: Wed, 10 Nov 2004 14:56:07 +0100 From: Stefan.Neis at t-online.de Subject: Re: Debugging tar Hi, > How do I set about debugging GNU TAR 1.14 which builds out of the box and > runs but core dumps in the process? It depends on the compiler you're using. If it's Innotek's, the answer is, "I have no idea". If it's EMX, compile an a.out version with additional option -ggdb (i.e. discard -Zomf from all those environment variables/Makefiles and add -ggdb in its place -- and remove AR=emxomfar and rebuild everything). Once you have such an executable, load it into gdb (gdb tar.exe) and run it inside gdb with suitable parameters ("run xf tarfile.tar" if you normally used "tar xf tarfile.tar"). When it crashes, it will tell you stuff like "got SIGSEGV in foo(..) in bar.cpp, line xyz" (unless your app managed to trash the stack in which case things get somewhat harde, but let's be optimists for now). Then look at the source of the given source file and line and try to understand what's wrong about it... Using "print " you can examine the values of interesting variables, using "bt" you can look at where the function was called from, using "up" you can go to the calling function and examine its variables ... I guess, that's enough for an initial gdb crash course, what I described doesn't really help in more subtle cases (e.g. if stack or heap are trashed) as then the crash is going to happen in a seemingly random location that's typically the place where the runtime _notices_ that somthing is very wrong, but not the place where the actual error happened. But for "easy" cases the above should be sufficient... Regards, Stefan **= Email 4 ==========================** Date: Wed, 10 Nov 2004 15:19:49 +0100 From: Stefan.Neis at t-online.de Subject: Re: \n conversion with TR ** Reply to note from John Poltorak Wed, 10 Nov 2004 13:37:56 +0000 > > On Wed, Nov 10, 2004 at 02:22:33PM +0100, Stefan.Neis at t-online.de wrote: > > Rather sounds like a job for "sed" (maybe something like > > sed "s/\n/\r\n/" or sed "s/$/\r/" or similar). > > Good suggestion! > > This works:- > > sed "s/$//" foo >foo.tmp > > Don't ask me to explain why it works :-)... Apparently "sed" (at least the version you are using) is using native linebreaks, which probably means it would be difficult to use it to convert CRLF to LF-only - I remember I got bitten(?) by that behaviour some time ago with one of these tools ... BTW, just for fun: does 'sed "s///" foo > foo.tmp' work as well? Regards, Stefan **= Email 5 ==========================** Date: Wed, 10 Nov 2004 08:15:50 -0800 From: "Dave Yeo" Subject: Re: Debugging tar On Wed, 10 Nov 2004 14:56:07 +0100, Stefan.Neis at t-online.de wrote: >Once you have such an executable, load it into gdb (gdb tar.exe) >and run it inside gdb with suitable parameters ("run xf >tarfile.tar" if you normally used "tar xf tarfile.tar"). > >When it crashes, it will tell you stuff like >"got SIGSEGV in foo(..) in bar.cpp, line xyz" >(unless your app managed to trash the stack in which case > things get somewhat harde, but let's be optimists for now). >Then look at the source of the given source file and line and try >to understand what's wrong about it... >Using "print " you can examine the values of interesting >variables, using "bt" you can look at where the function was called >from, using "up" you can go to the calling function and examine its >variables ... > >I guess, that's enough for an initial gdb crash course, what I >described doesn't really help in more subtle cases (e.g. if stack or >heap are trashed) as then the crash is going to happen in a seemingly >random location that's typically the place where the runtime _notices_ >that somthing is very wrong, but not the place where the actual error >happened. But for "easy" cases the above should be sufficient... Can I add that EMX also includes a PM version of gdb, pmgdb which might be easier to start with. It also has a tutorial in the help file Dave **= Email 6 ==========================** Date: Wed, 10 Nov 2004 16:28:21 +0000 From: John Poltorak Subject: Re: Debugging tar On Wed, Nov 10, 2004 at 02:56:07PM +0100, Stefan.Neis at t-online.de wrote: > Hi, > > > How do I set about debugging GNU TAR 1.14 which builds out of the box and > > runs but core dumps in the process? > > It depends on the compiler you're using. > If it's Innotek's, the answer is, "I have no idea". > > If it's EMX, compile an a.out version with additional option -ggdb > (i.e. discard -Zomf from all those environment variables/Makefiles and > add -ggdb in its place -- and remove AR=emxomfar and rebuild > everything). Just building it out of the box using autoconf and configure creates a top level Makefile with nothing assigned to CFLAGS or LDFLAGS. Should I just change this to:- CFLAGS = -ggdb and run make? If so, would I need to change the other Makefiles too? > Regards, > Stefan -- John **= Email 7 ==========================** Date: Wed, 10 Nov 2004 17:58:57 +0000 From: John Poltorak Subject: Re: \n conversion with TR On Wed, Nov 10, 2004 at 03:19:49PM +0100, Stefan.Neis at t-online.de wrote: > BTW, just for fun: does 'sed "s///" foo > foo.tmp' work as well? [C:\]sed "s///" foo >foo.tmp sed: -e expression #1, char 4: No previous regular expression However, it does work when using "s/^//". > Regards, > Stefan -- John **= Email 8 ==========================** Date: Wed, 10 Nov 2004 19:27:30 +0100 From: "Knut St. Osmundsen" Subject: Re: \n conversion with TR tr -d '\r' should work, but I think most of the OS/2 tr port uses treats stdout as a text file and will readd '\r' when outputting the result. (I have a vague recollection of editing tr.exe with the hackers view editor to fix this for gcc/binutils building.) Kind Regards, knut Stefan.Neis at t-online.de wrote: > ** Reply to note from John Poltorak Wed, 10 Nov 2004 13:37:56 +0000 > >> >>On Wed, Nov 10, 2004 at 02:22:33PM +0100, Stefan.Neis at t-online.de wrote: >> >>>Rather sounds like a job for "sed" (maybe something like >>>sed "s/\n/\r\n/" or sed "s/$/\r/" or similar). >> >> >>Good suggestion! >> >>This works:- >> >>sed "s/$//" foo >foo.tmp >> >>Don't ask me to explain why it works :-)... > > > Apparently "sed" (at least the version you are using) is using native > linebreaks, which probably means it would be difficult to use it to > convert CRLF to LF-only - I remember I got bitten(?) by that behaviour > some time ago with one of these tools ... > > BTW, just for fun: does 'sed "s///" foo > foo.tmp' work as well? > > Regards, > Stefan > > > > > **= Email 9 ==========================** Date: Wed, 10 Nov 2004 13:43:22 -0500 (EST) From: Thomas Dickey Subject: Re: \n conversion with TR On Wed, 10 Nov 2004, Knut St. Osmundsen wrote: > > tr -d '\r' should work, but I think most of the OS/2 tr port uses treats > stdout as a text file and will readd '\r' when outputting the result. (I > have a vague recollection of editing tr.exe with the hackers view editor > to fix this for gcc/binutils building.) I'd use flip. It doesn't change the file's timestamps. One problem with that is that it treats Latin-1 characters as "binary" and may refuse to modify the files. (But that's easily patched). -- Thomas E. Dickey http://invisible-island.net ftp://invisible-island.net **= Email 10 ==========================** Date: Wed, 10 Nov 2004 22:51:23 +0100 From: Stefan.Neis at t-online.de Subject: Re: Debugging tar > Should I just > change this to:- > > CFLAGS = -ggdb > > and run make? Sound like that should work.. > If so, would I need to change the other Makefiles too? Probably. Maybe just doing "make CFLAGS=-ggdb" without any editing is easier and still sufficient - I'm not exactly sure about the precedence of variable definitions, though ... Regards, Stefan **= Email 11 ==========================** Date: Wed, 10 Nov 2004 19:08:25 -0800 From: "Steven Levine" Subject: Re: Debugging tar In <20041110162821.N84 at warpix.org>, on 11/10/04 at 04:28 PM, John Poltorak said: >Just building it out of the box using autoconf and configure creates a >top level Makefile with nothing assigned to CFLAGS or LDFLAGS. Should I >just change this to:- >CFLAGS = -ggdb You might want: CFLAGS = -ggdb $(CFLAGS) to pick up the value set by the default rules. Steven -- ---------------------------------------------------------------------- "Steven Levine" MR2/ICE 2.60b #10183 Warp4/FP15/14.093c_W4 www.scoug.com irc.fyrelizard.com #scoug (Wed 7pm PST) ---------------------------------------------------------------------- **= Email 12 ==========================** Date: Thu, 11 Nov 2004 10:52:18 +0000 From: John Poltorak Subject: Re: Debugging tar On Wed, Nov 10, 2004 at 02:56:07PM +0100, Stefan.Neis at t-online.de wrote: > > > How do I set about debugging GNU TAR 1.14 which builds out of the box and > > runs but core dumps in the process? > > Once you have such an executable, load it into gdb (gdb tar.exe) > and run it inside gdb with suitable parameters ("run xf > tarfile.tar" if you normally used "tar xf tarfile.tar"). OK, I've got this far, but PMGDB looks > When it crashes, it will tell you stuff like > "got SIGSEGV in foo(..) in bar.cpp, line xyz" No I don't see anything like that. After starting tar with 'tf foo.tar' it gets to line 1494:- start_time = time (0); which is the first line of code in the main() function of tar.c. When I select Run->Go the pmgdb window shows:- Program exited with code 02. There is no indication where it got to in the source code. I've also noticed that I can't copy to the clipboard from any pmgdb window. Is this normal? So at this point I don't know how to get pmgdb to show where it got to before the program exited... Looks like a steep learning curve. If any pmgdb experts want to have a look at my tar build I can zip it up and let you have it. Maybe you could make something of it. > Regards, > Stefan > > -- John **= Email 13 ==========================** Date: Thu, 11 Nov 2004 12:33:15 +0100 (CET) From: Stefan.Neis at t-online.de Subject: Re: Debugging tar John Poltorak schrieb: > Program exited with code 02. > > There is no indication where it got to in the source > code. That's just telling you that the program ended without error, so everything is OK ... > So at this point I don't know how to get pmgdb to show > where it got to > before the program exited... Looks like a steep learning > curve. It will only show something if it crashes, if everything is fine, it doesn't show very much (unless you "step" through the code line by line which can be quite interesting/informative, but if there is no bug occuring, there isn't much point to it ... Stefan **= Email 14 ==========================** Date: Thu, 11 Nov 2004 12:36:46 +0100 (CET) From: "Yuri Dario" Subject: Re: Debugging tar Hi John, >If any pmgdb experts want to have a look at my tar build I can zip it up >and let you have it. Maybe you could make something of it. I will look at tar once I will get tired of using BackAgain/2 4.1 And it can happen soon, since BA has some problems, it doesn't support large files, it is not updated, and other. But it has a GUI... BTW I was looking at it as backup tool for amanda (www.amanda.org). Bye, Yuri Dario /* * member of TeamOS/2 - Italy * http://www.os2power.com/yuri * http://www.teamos2.it */ **= Email 15 ==========================** Date: Thu, 11 Nov 2004 11:42:27 +0000 From: John Poltorak Subject: Re: Debugging tar On Thu, Nov 11, 2004 at 12:33:15PM +0100, Stefan.Neis at t-online.de wrote: > John Poltorak schrieb: > > > Program exited with code 02. > > > > There is no indication where it got to in the source > > code. > > That's just telling you that the program ended without > error, so everything is OK ... When I run it at the command line it ends with:- Abnormal program termination core dumped ???? So it looks like something is wrong. > Stefan -- John **= Email 16 ==========================** Date: Thu, 11 Nov 2004 12:11:52 +0000 From: John Poltorak Subject: Re: Debugging tar On Thu, Nov 11, 2004 at 12:36:46PM +0100, Yuri Dario wrote: > Hi John, > > >If any pmgdb experts want to have a look at my tar build I can zip it up > >and let you have it. Maybe you could make something of it. > > > I will look at tar once I will get tired of using BackAgain/2 4.1 Let me know, and I'll zip up my TAR workdirectory and send it to you. > And it can happen soon, since BA has some problems, it doesn't support large files, it is not > updated, and other. But it has a GUI... You can get a GUI for tar - PMGTAK... BTW have you ever used IBM's ADSM? I tried it a couple of times and it seemed pretty neat, but was incredibly slow with tapes - no idea why - maybe I didn't configure it properly. > BTW I was looking at it as backup tool for amanda (www.amanda.org). If you manage to create an OS/2 version let us know about it. Actually I had an idea about trying to develop my own backup program because I get annoyed about backing up multiple copies of the same files. The idea was to copy unique files to a database with an index pointing to where they should be restored to, so that if you had ten systems with identical copies of something like OS2KRNL for instance, you would only store a single backup copy but have pointers showing which systems needed it. Essentially each system would have a file listing with each file being identified by a number and stored in a database. Never got very far in thinking it through though... > Bye, > > Yuri Dario > > /* > * member of TeamOS/2 - Italy > * http://www.os2power.com/yuri > * http://www.teamos2.it > */ -- John