This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: sed and dos format


Brian Dessent wrote:
> Hannu E K Nevalainen wrote:
>
>> You wrote:
>>> james pentland wrote:
>>>
>>>> sed has the unfortunate property that it reduces dos
>>>> format line endings to unix format line endings.
>>>
>>> Use a text mode mount.
>>
>> Using a sledgahammer for a nail?
>>  Better to use unix2dos A.K.A. u2d.
>
> I disagree.  He said he was doing this with many files.  It's far
> easier to just mount the directory once as textmode and not have to
> change anything than it is to edit all his scripts to run u2d
> afterward, and have to remember to do that to all future scripts.

> One "mount" command versus potentially dozens of current and future
> script updates is hardly a "sledgehammer for a nail".  Plus textmode
> mounts will keep his files with DOS line endings no matter what
> processing he does, whereas "u2d" requires that he remember to run
> that command any time he changes a file with a cygwin program.  I
> don't see how you can advocate manually having to do that every time
> when there's a feature built in to Cygwin to handle this very thing
> and handle it more efficiently.
>
> Brian

james pentland also wrote:
> this makes sed unusable or undesirable for a large
> number of files i might want to edit.

I don't take this as an implication of 'bulk' edits. So your "many files"
falls on this. Also; using sed implies automatic changes.

What your refer to as beeing easy; to use a text mount has its pitfalls, and
that is why I'm writing this.

Using u2d is by far easier than using sed ;-). And as it is sed we're
talking about, the "automatic" nature of the thing indicates that he is
using a script - adding "u2d" at an apropriate point isn't hard.

Text mounts means that you have the potential danger of CRLF vs LF
confusion - at a point where you've forgotten that you have mounted in text
mode.

 To summarize somewhat on my text mode mount concerns;
1) Not always easy to remember which mount is text mode which is not.
   Do you check this out every time? - I don't.
2) The main danger is inadvertent(sp?) text conversion;
   This causes MUCH confusion/malfuction - problems which often lead
   to extensive "bug hunting". My experience is that the *last* you
   think of is CRLF vs LF problems in this situation.
3) In addition some(many?) cygwin/gnu tools has problems as soon as
   there is a text mount involved... (in addition to taking stdin as
   implication of "text mode requirement" as it seems)
    This situation is slowly getting better though.
3a) How many percent of cygwin users know exactly which tools to not
    use on text mounts?
3b) Yet another question is whether they (3a) do(can) keep an updated
    list of these - as patches are applied?

 IMO; to be safe: stay away from text mode mounts and you *won't* have to
remember nor worry as much.
 I'd say that it is easier to remember that you're working on a DOS file
(say a .bat) than to remember which of all mounts are in text mode.

Now you come and say things like "handle it more efficiently"; If I'm on a
futile bug hunt for hours before I can finish the job, then the efficiency
comes to a grand halt.

Also with "my way" (above) in mind you'll quite easily see that the
unreliability (wrt line endings) of a utility like sed as discussed here,
and 'cat <stdin' in a recent thread, will be a very big nuisance.

 In this situation it really is simple to add "u2d" or "d2u" as the last
command in a pipe. I'd call that efficient painkilling.


To sum it up;
 Its a free world, I can lay no obligation on you to do it my way.

 But you've got to give me the credit that I've got a point in my concerns.


/Hannu E K Nevalainen, B.Sc. EE Microcomputer systems            --72-->

** mailing list preference; please keep replies on list **

-- printf("LocalTime: UTC+%02d\n",(DST)? 2:1); --
--END OF MESSAGE--


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]