[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: newline conversion with EDITOR

From: Branko Čibej <brane_at_xbc.nu>
Date: 2002-01-28 20:19:13 CET

Greg Stein wrote:

>I'm a little unclear on where Branko wants the newline stuff to go here.
>IMO, there shouldn't be any newline conversion. The editor should be popped
>up, and we just suck out the data. I guess we kind of need to figure out
>what the newline style is, so that we can properly eliminate lines that
>start with SVN:.
>
>But I don't think we shold use FILE*. Using apr_file_t is portable. If it
>has drawbacks, then we should fix APR, not workaround it.
>
I think I summed that up pretty well in the comment in config_file.c:

  /* "Why," you ask yourself, "is he using stdio FILE's instead of
     apr_file_t's?" The answer is simple: newline translation. For
     all that it has an APR_BINARY flag, APR doesn't do newline
     translation in files. The only portable way I know to get
     translated text files is to use the standard stdio library. */

(I might have added here that stdio streams are buffered on the C source
level (getc is a macro), while APR files aren't.)

Sometimes we create or read files on the client that have nothing at all
to do with the repository. One such case is the $EDITOR feature, another
is "svn ci -F". For $EDITOR, we have to both create and read the file
with the correct (local) line endings. The stdio library already knows
how to do that. APR does not.

We can either use stdio for accessing these files, fix APR to accept an
APR_TRANSLATED flag at file open, or create a subversion stream adapter
that grafts newline conversion on top of an ordinary APR file (using the
newline conversion code we already have). Personally I don't mind using
stdio for local text files, but I can live with any of these three
alternatives.

(When I wrote the config file parser, using stdio was the quickest
solution, so I did.)

-- 
Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:37:00 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.