public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Graham Dumpleton <Graham.Dumpleton@ra.pad.otc.com.au>
To: cygwin@sourceware.cygnus.com
Subject: B20.1: \r from DOS program breaks bash for loop
Date: Tue, 02 Mar 1999 21:25:00 -0000	[thread overview]
Message-ID: <199903030511.QAA07752@baldric.pad.otc.com.au> (raw)

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

WARNING: multiple messages have this Message-ID
From: Graham Dumpleton <Graham.Dumpleton@ra.pad.otc.com.au>
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	[thread overview]
Message-ID: <199903030511.QAA07752@baldric.pad.otc.com.au> (raw)
Message-ID: <19990331194500.9ekcQN-bexo25XERxqTk6qAdZN25pNhCsyqepgPFDeU@z> (raw)

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


             reply	other threads:[~1999-03-02 21:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-02 21:25 Graham Dumpleton [this message]
1999-03-31 19:45 ` Graham Dumpleton

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=199903030511.QAA07752@baldric.pad.otc.com.au \
    --to=graham.dumpleton@ra.pad.otc.com.au \
    --cc=cygwin@sourceware.cygnus.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).