Re: rsync and cygwin paths
On Wed, Jun 04, 2003 at 10:33:34AM -0700, Randall R Schulz wrote: > However for many purposes it's feasible to write some simple-minded > heuristics that make the determination about when and how to apply > "cygpath." I currently use a BASH script that uses a simple "case" > statement to paper over the Cygwin / Windows interface for invoking the > Java 2 SDK tools. The case statement's glob patterns detect whether any > given argument is (probably) a file name or PATH-like entity and then > applies cygpath as necessary. It can be fooled, of course, but in > practice it works fine for me. Gosh, you accomplish that with a mere bash script? I wrote an entire class to handle that ;-). Over-working myself as usual I expect! Ten-dollar solutions to 5-cent problems, that's my motto! Soren A. -- See my OpenPGP key at https://savannah.gnu.org/people/viewgpg.php?user_id=6050 GnuPG public key fingerprint | "Only when efforts to reform society have as BD26 A5D8 D781 C96B 9936 | their point of departure the reformation of 310F 0573 A3D9 4E24 4EA6 | the inner life -- human revolution -- will they lead us with certainty to a world of lasting peace and true human security." -- Daisaku Ikeda -- 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/
Re: rsync and cygwin paths
At 10:44 2003-06-04, Igor Pechtchanski wrote: On Wed, 4 Jun 2003, Randall R Schulz wrote: > At 10:06 2003-06-04, Igor Pechtchanski wrote: > >On Wed, 4 Jun 2003, Lapo Luchini wrote: > > > > > ... > > > > > > http://cygwin.com/cygwin-ug-net/using-utils.html#CYGPATH > > > > > > NEWARGS="" > > > for arg in $@ ; > > > do > > > if [ -e "${arg}" ]; then > > > NEWARGS="${NEWARGS} `cygpath -p -w "$arg"`" > > > else > > > NEWARGS="${NEWARGS} $arg" > > > fi > > > done > > > >Lapo, > > > >Note that the above won't work correctly if the program is expected to > >create the file with a given name... IMO, there is no way of writing a > >generic wrapper script without knowing anything about program parameters. > > Igor > > > Igor, > > Strictly speaking, that's true. Certainly Lapo's script fragment is too > simple-minded to work in any kind of general setting. > > However for many purposes it's feasible to write some simple-minded > heuristics that make the determination about when and how to apply > "cygpath." I currently use a BASH script that uses a simple "case" > statement to paper over the Cygwin / Windows interface for invoking the > Java 2 SDK tools. The case statement's glob patterns detect whether any > given argument is (probably) a file name or PATH-like entity and then > applies cygpath as necessary. It can be fooled, of course, but in > practice it works fine for me. > > Randall Schulz Randall, I agree, Java is not too hard. I believe I've posted the wrapper script that I used at one point or another. Certainly the parameters to Java itself can be recognized exactly. It's also easy enough to decide that anything in the program arguments with a '/' in it is a filename, and convert it accordingly. WFM (tm). I was talking about the general case, for an unknown Win32 application. Igor Igor, While I mostly only use my wrapper for Java, there's no specific knowledge of the Java SDK tools built into it (there are 26 of them!). The only time I've seen it mess up is when I use an argument to "javadoc" with the English construct "and / or" (or, more likely, the computer term "I/O"), the forward slash gets changed to a backslash. This is pretty much the only kind of problem you're likely to get into with a generic approach. Things that can be construed as Cygwin file names but are not get inappropriately transformed, of course. One can always refine the pattern detection in the wrapper script if necessary. WFM? Of course. What else matters?? Randall Schulz -- 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/
Re: rsync and cygwin paths
On Wed, 4 Jun 2003, Randall R Schulz wrote: > At 10:06 2003-06-04, Igor Pechtchanski wrote: > >On Wed, 4 Jun 2003, Lapo Luchini wrote: > > > > > ... > > > > > > Please notice that there is a default prgoramm called "cygpath" that's > > > really useful to convert path- and file-names between the two version, > > > and it's not so hard to create "wrapper scripts" to convert them, e.g. > > > (I copied this long ago from I-don't-remember-where): > > > > > > http://cygwin.com/cygwin-ug-net/using-utils.html#CYGPATH > > > > > > NEWARGS="" > > > for arg in $@ ; > > > do > > > if [ -e "${arg}" ]; then > > > NEWARGS="${NEWARGS} `cygpath -p -w "$arg"`" > > > else > > > NEWARGS="${NEWARGS} $arg" > > > fi > > > done > > > >Lapo, > > > >Note that the above won't work correctly if the program is expected to > >create the file with a given name... IMO, there is no way of writing a > >generic wrapper script without knowing anything about program parameters. > > Igor > > > Igor, > > Strictly speaking, that's true. Certainly Lapo's script fragment is too > simple-minded to work in any kind of general setting. > > However for many purposes it's feasible to write some simple-minded > heuristics that make the determination about when and how to apply > "cygpath." I currently use a BASH script that uses a simple "case" > statement to paper over the Cygwin / Windows interface for invoking the > Java 2 SDK tools. The case statement's glob patterns detect whether any > given argument is (probably) a file name or PATH-like entity and then > applies cygpath as necessary. It can be fooled, of course, but in > practice it works fine for me. > > Randall Schulz Randall, I agree, Java is not too hard. I believe I've posted the wrapper script that I used at one point or another. Certainly the parameters to Java itself can be recognized exactly. It's also easy enough to decide that anything in the program arguments with a '/' in it is a filename, and convert it accordingly. WFM (tm). I was talking about the general case, for an unknown Win32 application. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_[EMAIL PROTECTED] ZZZzz /,`.-'`'-. ;-;;,_[EMAIL PROTECTED] |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "I have since come to realize that being between your mentor and his route to the bathroom is a major career booster." -- Patrick Naughton -- 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/
Re: rsync and cygwin paths
At 10:06 2003-06-04, Igor Pechtchanski wrote: On Wed, 4 Jun 2003, Lapo Luchini wrote: > ... > > Please notice that there is a default prgoramm called "cygpath" that's > really useful to convert path- and file-names between the two version, > and it's not so hard to create "wrapper scripts" to convert them, e.g. > (I copied this long ago from I-don't-remember-where): > > http://cygwin.com/cygwin-ug-net/using-utils.html#CYGPATH > > NEWARGS="" > for arg in $@ ; > do > if [ -e "${arg}" ]; then > NEWARGS="${NEWARGS} `cygpath -p -w "$arg"`" > else > NEWARGS="${NEWARGS} $arg" > fi > done Lapo, Note that the above won't work correctly if the program is expected to create the file with a given name... IMO, there is no way of writing a generic wrapper script without knowing anything about program parameters. Igor Igor, Strictly speaking, that's true. Certainly Lapo's script fragment is too simple-minded to work in any kind of general setting. However for many purposes it's feasible to write some simple-minded heuristics that make the determination about when and how to apply "cygpath." I currently use a BASH script that uses a simple "case" statement to paper over the Cygwin / Windows interface for invoking the Java 2 SDK tools. The case statement's glob patterns detect whether any given argument is (probably) a file name or PATH-like entity and then applies cygpath as necessary. It can be fooled, of course, but in practice it works fine for me. Randall Schulz -- 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/
Re: rsync and cygwin paths
On Wed, 4 Jun 2003, Lapo Luchini wrote: > (cc to [EMAIL PROTECTED] so that people that knows ebtter what i'm > talking about can eventually correct me) > jw schultz wrote: > > >Perhaps that is the document he needs. If not could you > >cygwinese, cygwinites, cygwinists, cygwinim or whatever > >point him to one that will clear up the slash/backslash > >issues that still haven't been addressed. Rsync does not > >recognise backslashes as such in exclude patterns. Path > >components are expected to be delimited by slashes ("/") > >only. I expect the cygwin library translates as necessary. > > > Basically if you want to be sure about what you mean you better never > use "\". > > I think the "actual state" is: cygwin's open() tries to do its best to > open also "path with \" but most of the times there are 'problems' (that > are, of course, no 'problems' but its meant that way) in the code of the > app. itself that "block \" thinking they are "shell escapes" or anyway > invalid paths... so that only a few application can be really used with > "windows paths". > Avoiding them completely is the safest choiche. > > Please notice that there is a default prgoramm called "cygpath" that's > really useful to convert path- and file-names between the two version, > and it's not so hard to create "wrapper scripts" to convert them, e.g. > (I copied this long ago from I-don't-remember-where): > > http://cygwin.com/cygwin-ug-net/using-utils.html#CYGPATH > > NEWARGS="" > for arg in $@ ; > do > if [ -e "${arg}" ]; then > NEWARGS="${NEWARGS} `cygpath -p -w "$arg"`" > else > NEWARGS="${NEWARGS} $arg" > fi > done Lapo, Note that the above won't work correctly if the program is expected to create the file with a given name... IMO, there is no way of writing a generic wrapper script without knowing anything about program parameters. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_[EMAIL PROTECTED] ZZZzz /,`.-'`'-. ;-;;,_[EMAIL PROTECTED] |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "I have since come to realize that being between your mentor and his route to the bathroom is a major career booster." -- Patrick Naughton -- 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/
rsync and cygwin paths
(cc to [EMAIL PROTECTED] so that people that knows ebtter what i'm talking about can eventually correct me) jw schultz wrote: Perhaps that is the document he needs. If not could you cygwinese, cygwinites, cygwinists, cygwinim or whatever point him to one that will clear up the slash/backslash issues that still haven't been addressed. Rsync does not recognise backslashes as such in exclude patterns. Path components are expected to be delimited by slashes ("/") only. I expect the cygwin library translates as necessary. Basically if you want to be sure about what you mean you better never use "\". I think the "actual state" is: cygwin's open() tries to do its best to open also "path with \" but most of the times there are 'problems' (that are, of course, no 'problems' but its meant that way) in the code of the app. itself that "block \" thinking they are "shell escapes" or anyway invalid paths... so that only a few application can be really used with "windows paths". Avoiding them completely is the safest choiche. Please notice that there is a default prgoramm called "cygpath" that's really useful to convert path- and file-names between the two version, and it's not so hard to create "wrapper scripts" to convert them, e.g. (I copied this long ago from I-don't-remember-where): http://cygwin.com/cygwin-ug-net/using-utils.html#CYGPATH NEWARGS="" for arg in $@ ; do if [ -e "${arg}" ]; then NEWARGS="${NEWARGS} `cygpath -p -w "$arg"`" else NEWARGS="${NEWARGS} $arg" fi done -- Lapo 'Raist' Luchini [EMAIL PROTECTED] (PGP & X.509 keys available) http://www.lapo.it (ICQ UIN: 529796) -- 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/