From mboxrd@z Thu Jan 1 00:00:00 1970 From: Graham Dumpleton To: cygwin@sourceware.cygnus.com Subject: B20.1: \r from DOS program breaks bash for loop Date: Wed, 31 Mar 1999 19:45:00 -0000 Message-ID: <199903030511.QAA07752@baldric.pad.otc.com.au> X-SW-Source: 1999-03n/msg00037.html Message-ID: <19990331194500.9ekcQN-bexo25XERxqTk6qAdZN25pNhCsyqepgPFDeU@z> Below is described a problem which I have seen since b18, if not before. Currently I hack around it, but I would like to know for sure if that is what I will have to continue to do or whether it is a bug in bash. If I remember correctly, I reported this problem back around b18. I haven't been able to search the mailing list archive properly for related mail as the search engine is coming up as unavailable when I try. Anyway, in a GNU make makefile, I have targets which extract objects from a library which has been created with Visual C++. To do the extraction of the objects from the library, it is necessary to get a list of the objects in the library and then extract one at a time. The problem is that the list of objects produced has \r\n at the end of each line. The \r stays there and ends up being taken to be part of the actual text of the line when the output is used as the list in a for loop. The extraction then fails because there isn't a file with a \r appended in the library. Ie., the following fails. AR = /Program\ Files/Microsoft\ Visual\ Studio/VC98/bin/lib define DEFAULT_LIB_EXTRACT1 for obj in `$(AR) lib.lib /NOLOGO /LIST`; do \ $(AR) lib.lib /NOLOGO /EXTRACT:$${obj}; done endef all1 : $(DEFAULT_LIB_EXTRACT1) With error messages like: LIB : warning LNK4014: cannot find member object otccopy.obj^M LIB : warning LNK4014: cannot find member object otcfuncbuf.obj^M LIB : warning LNK4014: cannot find member object otcfuncstrm.obj^M LIB : warning LNK4014: cannot find member object otchash.obj^M LIB : warning LNK4014: cannot find member object otcrank.obj^M LIB : warning LNK4014: cannot find member object otctermnate.obj^M LIB : warning LNK4014: cannot find member object otcvfuncbuf.obj^M Note that I have piped the output through less so the ^M showed up and then cut and paste that. To get around this I currently do: define DEFAULT_LIB_EXTRACT2 for obj in `$(AR) lib.lib /NOLOGO /LIST`; do \ $(AR) lib.lib /NOLOGO /EXTRACT:`echo $${obj} | tr '^M' ' '`; done endef all2 : $(DEFAULT_LIB_EXTRACT2) Ie., translate '^M' to ' ' in the name before using it. Note that that is an actual ^M in the makefile and not ^ and M. In this mail it is done as ^ and M as qmail rejects it otherwise. Ideas, solutions? -- Graham Dumpleton (grahamd@nms.otc.com.au) -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe@sourceware.cygnus.com