* introduction, fix for npm w.r.t. git, and questions @ 2016-04-20 15:31 Brian Clifton 2016-04-20 15:44 ` Eliot Moss 2016-04-20 19:30 ` Adam Dinwoodie 0 siblings, 2 replies; 7+ messages in thread From: Brian Clifton @ 2016-04-20 15:31 UTC (permalink / raw) To: cygwin Hi folks, (I've never joined a mailing list so please bear with me as I learn how this works) ######## Quick intro ######## My name is Brian, I'm a developer at a hosting company in Arizona, USA and I really enjoy Cygwin. I mostly use it at home and I appreciate all of the work everyone has done. It has made my life easier for sure. ######## Git using Windows paths ######## I saw the email chain regarding Git using Windows paths; I wanted to share that I've been fighting that too. Specifically, npm will fail npm installs because it will try to use the Windows path. I submitted the following PR to fix that: https://github.com/npm/npm/pull/12366 The PR was denied but you can see the patch made and manually apply this yourself. Since it was rejected, I'm trying to find a better way to do this. I am considering a solution by creating a git() function in my bashrc like so: function git { for var in "$@" do if [[ $var == *":\\"* ]]; then $var="$(cygpath $var)" #this doesn't work, but the idea is to do something like this fi done command git "$@" } I wanted to ask what you all think about this approach. Since Cygwin converts the paths, filtering any git input through cygpath makes sense, IMO. With how many folks experience issues w/ git on Cygwin, I'd like to help popularize *some* kind of fix, whatever it might be, since NPM and likely other projects are not willing to support Cygwin. ######## Quick question(s) ######## Is the website source available in git? If so, would folks be open to PRs with styling changes and/or documentation updates? Thanks Brian -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: introduction, fix for npm w.r.t. git, and questions 2016-04-20 15:31 introduction, fix for npm w.r.t. git, and questions Brian Clifton @ 2016-04-20 15:44 ` Eliot Moss 2016-04-20 19:30 ` Adam Dinwoodie 1 sibling, 0 replies; 7+ messages in thread From: Eliot Moss @ 2016-04-20 15:44 UTC (permalink / raw) To: cygwin I see no reason why a function similar on concept to what you write, i.e., one that applies cygpath to convert full Windows paths to cygwin style paths, should not work. I have a number of simple function that do the opposite, allowing me to invoke Windows programs (such as Word) with cygwin paths by converting to the equivalent Windows path first. This requires careful attention to quoting and such, but is conceptually not that hard. If you end up struggling with it, I can probably write something suitable for you ... Eliot Moss -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: introduction, fix for npm w.r.t. git, and questions 2016-04-20 15:31 introduction, fix for npm w.r.t. git, and questions Brian Clifton 2016-04-20 15:44 ` Eliot Moss @ 2016-04-20 19:30 ` Adam Dinwoodie 2016-04-20 20:37 ` silverwind 1 sibling, 1 reply; 7+ messages in thread From: Adam Dinwoodie @ 2016-04-20 19:30 UTC (permalink / raw) To: cygwin On Wed, Apr 20, 2016 at 03:21:27PM +0000, Brian Clifton wrote: > (I've never joined a mailing list so please bear with me as I learn how this works) Hi Brian, welcome! > I saw the email chain regarding Git using Windows paths; I wanted to > share that I've been fighting that too. Specifically, npm will fail > npm installs because it will try to use the Windows path. I submitted > the following PR to fix that: > > https://github.com/npm/npm/pull/12366 My JavaScript is somewhat rusty, and I've never used npm, but it looks to me that the problem here is that npm's `process.platform` in `git.js` is set to 'win32'. Cygwin isn't 'win32' -- it's a fundamentally different beast that just happens to sit on top of Windows -- so attempting to treat Cygwin as Windows is going to cause all sorts of pain. I think the "correct" fix would be to get npm (or possibly the JavaScript engine itself?) to stop acting as if it's in a Windows environment when it's running under Cygwin; the Cygwin environment is much more like a *nix environment than anything else. I've no idea what that change would involve, though. > With how many folks experience issues w/ git on Cygwin, > I'd like to help popularize *some* kind of fix, whatever it might be, > since NPM and likely other projects are not willing to support Cygwin. This sort of experience is, as best I can tell, pretty rare actually. Generally if you have a user (or a process) running within Cygwin, it's expecting to use POSIX-style paths exclusively -- the whole point of Cygwin being to provide a POSIX-like environment on Windows -- and the only time you need to think about Windows-style paths is if you're calling a native Windows application from within Cygwin (at which point you normally know that's what you're doing and can use cygpath). -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: introduction, fix for npm w.r.t. git, and questions 2016-04-20 19:30 ` Adam Dinwoodie @ 2016-04-20 20:37 ` silverwind 2016-04-20 21:05 ` Adam Dinwoodie 0 siblings, 1 reply; 7+ messages in thread From: silverwind @ 2016-04-20 20:37 UTC (permalink / raw) To: cygwin > I think the "correct" fix would be to get npm (or possibly the > JavaScript engine itself?) to stop acting as if it's in a Windows > environment You're on the right track. The root issue is that Node.js (on which npm runs) is a native Windows binary in pretty much all cases, as it's not possible to build it or v8 (the JS engine) through Cygwin's toolchain, at least not without numerous modifications. Node.js had actual support for Cygwin until 0.4.2 (which is ancient), after which it was dropped, presumably because of v8 build issues. If one were to obtain a Cygwin-built Node.js binary, `process.platform` would be `Linux` and npm would happily feed POSIX paths into git. Regards, Romain -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: introduction, fix for npm w.r.t. git, and questions 2016-04-20 20:37 ` silverwind @ 2016-04-20 21:05 ` Adam Dinwoodie 2016-04-20 22:10 ` silverwind 0 siblings, 1 reply; 7+ messages in thread From: Adam Dinwoodie @ 2016-04-20 21:05 UTC (permalink / raw) To: cygwin On Wed, Apr 20, 2016 at 09:30:33PM +0200, silverwind wrote: > >I think the "correct" fix would be to get npm (or possibly the > >JavaScript engine itself?) to stop acting as if it's in a Windows > >environment > You're on the right track. The root issue is that Node.js (on which > npm runs) is a native Windows binary in pretty much all cases, as > it's not possible to build it or v8 (the JS engine) through Cygwin's > toolchain, at least not without numerous modifications. Node.js had > actual support for Cygwin until 0.4.2 (which is ancient), after > which it was dropped, presumably because of v8 build issues. > > If one were to obtain a Cygwin-built Node.js binary, > `process.platform` would be `Linux` and npm would happily feed POSIX > paths into git. I think, sadly, this is something that's just not intended to work. It does work sometimes, but it's as much luck as judgement when it does. Fundamentally you're need a native Windows application (Node.js/v8) to be aware of Cygwin -- possible in specific instances by using wrapper scripts or interface layers, but impossible in general because, for a start, a native Windows application isn't going to have linked to cygwin1.dll -- or a native Cygwin application (in this case Git) to be aware of Windows, which goes against the principle of Cygwin providing a compatibility layer that means *nix source code can be compiled without needing to care about the fact that it's actually running in a Windows environment. (Yes Git has some Cygwin-specific code, but I think the bits that are actually specific to Cygwin only are very small; most of it is just different build options to account for differences in the same way Git has BSD or Darwin-specific build options.) Ideally, you'd get Node.js and v8 to compile and run within Cygwin. Having attempted a similar task for the Golang compiler, though, I'm not expecting that to be feasible, if it isn't supported upstream, at least without some significant effort. Failing that, given you're using native Windows v8, Node.js and npm, your best bet may be to use the native Windows Git client, so npm's entire toolchain is native Windows applications rather than a mix of native Windows and Cygwin. It's been a while since I tried it, but I _think_ you can generally use Cygwin Git and Windows Git on the same working copy without any difficulties, at least if you avoid the common pain points like line ending rewriting and symlinks. The final option, given you have a patch for npm that apparently gets this all working anyway, may just be to create a fork of npm yourself, patch support for Cygwin back in, and use that instead. If the fixes to get Cygwin working are simple enough, it should be reasonably easy to keep merging changes in the upstream repository to your fork. HTH Adam -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: introduction, fix for npm w.r.t. git, and questions 2016-04-20 21:05 ` Adam Dinwoodie @ 2016-04-20 22:10 ` silverwind 2016-04-20 23:14 ` Adam Dinwoodie 0 siblings, 1 reply; 7+ messages in thread From: silverwind @ 2016-04-20 22:10 UTC (permalink / raw) To: cygwin On 4/20/16 10:59 PM, Adam Dinwoodie wrote: > native Windows and Cygwin. It's been a while since I tried it, but I > _think_ you can generally use Cygwin Git and Windows Git on the same > working copy without any difficulties, at least if you avoid the common > pain points like line ending rewriting and symlinks. I've tried the native Windows version of git while debugging this, and yes, it accepts Windows-style paths correctly. The deal-breaking issue with it for me was that it trashed the file permissions under Cygwin. Every file it touched (be it through clone, add or any other operation) was set to mode 777, so `git config core.fileMode false` would've been necessary to stay sane, but that of course comes with the drawback of not being able to change file modes. Regards, Roman -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: introduction, fix for npm w.r.t. git, and questions 2016-04-20 22:10 ` silverwind @ 2016-04-20 23:14 ` Adam Dinwoodie 0 siblings, 0 replies; 7+ messages in thread From: Adam Dinwoodie @ 2016-04-20 23:14 UTC (permalink / raw) To: cygwin On Wed, Apr 20, 2016 at 11:17:35PM +0200, silverwind wrote: > On 4/20/16 10:59 PM, Adam Dinwoodie wrote: > >native Windows and Cygwin. It's been a while since I tried it, but I > >_think_ you can generally use Cygwin Git and Windows Git on the same > >working copy without any difficulties, at least if you avoid the common > >pain points like line ending rewriting and symlinks. > > I've tried the native Windows version of git while debugging this, > and yes, it accepts Windows-style paths correctly. > > The deal-breaking issue with it for me was that it trashed the file > permissions under Cygwin. Every file it touched (be it through > clone, add or any other operation) was set to mode 777, so `git > config core.fileMode false` would've been necessary to stay sane, > but that of course comes with the drawback of not being able to > change file modes. Yes, that's definitely a catch; Windows seems to like to have executable flags on more-or-less everything. You can, if necessary, change filemodes with `git update-index --chmod=+x <file>` (or `--chmod=-x` to remove the executable flag); that'll stage the change to be committed when you run `git commit`, without touching the permissions on the actual checked out files. You're still not changing the file modes on the files you have checked out, but you're at least making the change for anyone else who uses your commits. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-04-20 22:23 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-04-20 15:31 introduction, fix for npm w.r.t. git, and questions Brian Clifton 2016-04-20 15:44 ` Eliot Moss 2016-04-20 19:30 ` Adam Dinwoodie 2016-04-20 20:37 ` silverwind 2016-04-20 21:05 ` Adam Dinwoodie 2016-04-20 22:10 ` silverwind 2016-04-20 23:14 ` Adam Dinwoodie
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).