[PATCH v2] cygcheck: expand common_apps list

2019-06-03 Thread Yaakov Selkowitz
An increasing number of tools are being included in Windows which have the
same names as those included in Cygwin packages.  Indicating which one is
first in PATH can be helpful in diagnosing behavioural discrepencies
between them.

Also, fix the alphabetization of ssh.
---
 winsup/utils/cygcheck.cc | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc
index d5972c0cf..2cc25d985 100644
--- a/winsup/utils/cygcheck.cc
+++ b/winsup/utils/cygcheck.cc
@@ -99,28 +99,43 @@ static common_apps[] = {
   {"awk", 0},
   {"bash", 0},
   {"cat", 0},
+  {"certutil", 0},
+  {"clinfo", 0},
+  {"comp", 0},
+  {"convert", 0},
   {"cp", 0},
   {"cpp", 1},
   {"crontab", 0},
+  {"curl", 0},
+  {"expand", 0},
   {"find", 0},
+  {"ftp", 0},
   {"gcc", 0},
   {"gdb", 0},
   {"grep", 0},
+  {"hostname", 0},
   {"kill", 0},
+  {"klist", 0},
   {"ld", 0},
   {"ls", 0},
   {"make", 0},
   {"mv", 0},
+  {"nslookup", 0},
   {"patch", 0},
   {"perl", 0},
+  {"replace", 0},
   {"rm", 0},
   {"sed", 0},
-  {"ssh", 0},
   {"sh", 0},
+  {"shutdown", 0},
+  {"sort", 0},
+  {"ssh", 0},
   {"tar", 0},
   {"test", 0},
+  {"timeout", 0},
   {"vi", 0},
   {"vim", 0},
+  {"whoami", 0},
   {0, 0}
 };
 
-- 
2.17.0



Re: [PATCH] cygcheck: expand common_apps list

2019-06-03 Thread Brian Inglis
On 2019-06-03 13:35, Corinna Vinschen wrote:
> On May 23 13:05, Yaakov Selkowitz wrote:
>> An increasing number of tools are being included in Windows which have the
>> same names as those included in Cygwin packages.  Indicating which one is
>> first in PATH can be helpful in diagnosing behavioural discrepencies
>> between them.
>> Also, fix the alphabetization of ssh.
> on second thought you don't have to wait for Brian's reply.  Just
> push this.  If Brian has some more input, you can easily add another
> patch, right?

Haven't upgraded or bounced anything since then. Maybe after next Tuesday.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.


Re: [PATCH] mkdir: always check-for-existence

2019-06-03 Thread Ben

When creating a directory which already exists, NtCreateFile will correctly
return 'STATUS_OBJECT_NAME_COLLISION'.

However when creating a directory and all its parents a normal use would
be to start with mkdir(‘/cygdrive/c’) which translates to ‘C:\’ for 
which it'll

instead return ‘STATUS_ACCESS_DENIED’.

So we better check for existence prior to calling NtCreateFile.
---
 winsup/cygwin/dir.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc
index f43eae461..b757851d5 100644
--- a/winsup/cygwin/dir.cc
+++ b/winsup/cygwin/dir.cc
@@ -331,8 +331,10 @@ mkdir (const char *dir, mode_t mode)
       debug_printf ("got %d error from build_fh_name", fh->error ());
       set_errno (fh->error ());
     }
+  else if (fh->exists ())
+    set_errno (EEXIST);
   else if (has_dot_last_component (dir, true))
-    set_errno (fh->exists () ? EEXIST : ENOENT);
+    set_errno (ENOENT);
   else if (!fh->mkdir (mode))
     res = 0;
   delete fh;

--
2.21.0



Re: [PATCH] cygcheck: expand common_apps list

2019-06-03 Thread Corinna Vinschen
Hi Yaakov,

On May 23 13:05, Yaakov Selkowitz wrote:
> An increasing number of tools are being included in Windows which have the
> same names as those included in Cygwin packages.  Indicating which one is
> first in PATH can be helpful in diagnosing behavioural discrepencies
> between them.
> 
> Also, fix the alphabetization of ssh.

on second thought you don't have to wait for Brian's reply.  Just
push this.  If Brian has some more input, you can easily add another
patch, right?


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer


signature.asc
Description: PGP signature


Re: [PATCH] mkdir: alway check-for-existence

2019-06-03 Thread Corinna Vinschen
Hi Ben,

I'm fine with the patch, and it's short enough not to require an entry
in the CONTRIBUTORS file, but the commit msg needs some rephrasing:

On Jun  3 20:31, Ben wrote:
> When using either CreateDirectory or NtCreateFile when creating a directory
> that already exists, these functions return: ERROR_ALREADY_EXISTS

The Win32 and NT error codes don't match, so I'd prefer to drop
CreateDirectory from the text and use the NT status code names,
STATUS_OBJECT_NAME_COLLISION and STATUS_ACCESS_DENIED.

> However when using these function to create a directory (and all its
> parents)
> a normal use would be to start with mkdir(‘/c’) which translates to ‘C:\’

mkdir('/c') has no meaning by default.  The text should refer to the
default path "/cygdrive/c".

> for which both of these functions return ‘ERROR_ACCESS_DENIED’
> 
> We could call NtCreateFile with 'FILE_OPEN_IF' instead of 'FILE_CREATE' but
> since that's an internal function we better always check for existence
> ourselves.

Not sure what you're trying to say here.  In how far would using
FILE_OPEN_IF help?  AFAICS it would just erroneously return
STATUS_SUCCESS, so fhandler_disk_file::mkdir would have to check
io.Information for FILE_OPENED or something like that.  Maybe this
paragraph can just go away?


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer


signature.asc
Description: PGP signature


[PATCH] mkdir: alway check-for-existence

2019-06-03 Thread Ben

When using either CreateDirectory or NtCreateFile when creating a directory
that already exists, these functions return: ERROR_ALREADY_EXISTS

However when using these function to create a directory (and all its 
parents)

a normal use would be to start with mkdir(‘/c’) which translates to ‘C:\’
for which both of these functions return ‘ERROR_ACCESS_DENIED’

We could call NtCreateFile with 'FILE_OPEN_IF' instead of 'FILE_CREATE' but
since that's an internal function we better always check for existence
ourselves.

Signed-off-by: Ben Wijen 
---
 winsup/cygwin/dir.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc
index f43eae461..b757851d5 100644
--- a/winsup/cygwin/dir.cc
+++ b/winsup/cygwin/dir.cc
@@ -331,8 +331,10 @@ mkdir (const char *dir, mode_t mode)
       debug_printf ("got %d error from build_fh_name", fh->error ());
       set_errno (fh->error ());
     }
+  else if (fh->exists ())
+    set_errno (EEXIST);
   else if (has_dot_last_component (dir, true))
-    set_errno (fh->exists () ? EEXIST : ENOENT);
+    set_errno (ENOENT);
   else if (!fh->mkdir (mode))
     res = 0;
   delete fh;

--
2.21.0




Re: [PATCH 1/2] Cygwin: fork: Always pause child after fixups.

2019-06-03 Thread Corinna Vinschen
On Apr 30 09:09, Michael Haubenwallner wrote:
> Pause the child process after performing fork fixups even if there were
> no dynamically loaded dlls with extra data/bss transfers to wait for.
> This allows the parent process to cancel the current fork call even if
> the child process was successfully initialized already.
> 
> This is a preparation for when the parent does remember the child no
> earlier than after successful child initialization.

Patchset pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer


signature.asc
Description: PGP signature


Re: [PATCH] Cygwin: dll_list: stat_real_file_once with ntname

2019-06-03 Thread Corinna Vinschen
On May  3 16:14, Michael Haubenwallner wrote:
> NtQueryVirtualMemory for MemorySectionName may return some old path even
> if the process was just started, for when some directory in between was
> renamed - maybe because the NT file cache is hot for the old path still.
> This was seen during gcc bootstrap, returning a MemorySectionName of
> ".../gcc/xgcc.exe" even if started as ".../prev-gcc/xgcc.exe", where the
> directory rename from "gcc" to "prev-gcc" was done the moment before.
> As we stat the module's real file right after loading now, there is no
> point in using NtQueryVirtualMemory with MemorySectionName any more, and
> we can use what GetModuleFileName returned instead.
> ---
>  winsup/cygwin/dll_init.cc |  2 +-
>  winsup/cygwin/forkable.cc | 40 +++
>  2 files changed, 8 insertions(+), 34 deletions(-)

Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer


signature.asc
Description: PGP signature


Re: [PATCH] Cygwin: dll_list: no recursive use of nt_max_path_buf

2019-06-03 Thread Corinna Vinschen
On May 13 16:36, Michael Haubenwallner wrote:
> Querying the ntlength and existence of the /var/run/cygfork directory in
> the very first Cygwin process should not use nt_max_path_buf, as that
> one is used by dll_list::alloc already.
> ---
>  winsup/cygwin/forkable.cc | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)

Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer


signature.asc
Description: PGP signature


Re: [rebase PATCH] Introduce --merge-files (-M) flag (WAS: Introduce --no-rebase flag)

2019-06-03 Thread Corinna Vinschen
On Jun  3 18:30, Corinna Vinschen wrote:
> On May  6 10:31, Michael Haubenwallner wrote:
> > 
> > On 5/4/19 4:33 PM, Brian Inglis wrote:
> > > On 2019-05-03 09:32, Michael Haubenwallner wrote:
> > >> On 4/12/19 8:03 PM, Corinna Vinschen wrote:
> > >>> On Apr 12 15:52, Michael Haubenwallner wrote:
> >  The --no-rebase flag is to update the database for new files, without
> > >>> Wouldn't something like --merge-files be more descriptive?
> > >> What about --recognize ?
> > > 
> > > "The --recognize flag is to update the database for new files, without
> > > performing a rebase.  The file names provided should have been rebased
> > > using the --oblivious flag just before."
> > > 
> > > Recognize does not mean record or update in English but see, identify, or
> > > acknowledge.
> > > 
> > > Your earlier suggestion of --record, the verb used in the comment quoted 
> > > above
> > > --update, or CV's suggestion --merge-files would make sense and be more
> > > descriptive.
> > 
> > On a first thought, "merge files" does have a different meaning in the 
> > Gentoo
> > context already, as in "merge files from staging directory into the live 
> > file
> > system".
> > However, on a second thought, "rebase --merge-files" is performed 
> > afterwards,
> > but still part of that "merge files" phase, so the name does actually fit.
> > 
> > Patch updated.
> 
> Pushed.

Just a FYI for the future, patches to Cygwin-specific tools should
usually go to cygwin-apps.  Not that the traffic here overwhelms
anybody...


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer


signature.asc
Description: PGP signature


Re: [PATCH draft 0/6] Remove the fhandler_base_overlapped class

2019-06-03 Thread Corinna Vinschen
On May 30 12:56, Ken Brown wrote:
> On 5/26/2019 11:10 AM, Ken Brown wrote:
> > fhandler_pipe is currently the only class derived from
> > fhandler_base_overlapped.  This patch series rewrites parts of
> > fhandler_pipe so that it can be derived from fhandler_base instead.
> > We can then simplify the code by removing fhandler_base_overlapped.
> > 
> > In particular, this gets rid of the peculiar situation in which a
> > non-blocking write can return with I/O pending, leading to the
> > ugliness in fhandler_base_overlapped::close.
> > 
> > I've marked these patches as drafts because I've undoubtedly
> > overlooked some things.  Also, I haven't systematically done any
> > regression tests.  I have, however, run all the sample pipe programs
> > in Kerrisk's book "The Linux Programming Interface: Linux and UNIX
> > System Programming Handbook".  I've also run emacs-X11, gdb, git,
> > make, etc., so far without problems.
> 
> This isn't ready for prime time yet.  I've run into occasional errors
> like this when doing a parallel build of emacs (-j13 in this case):
> 
> make: INTERNAL: Exiting with 14 jobserver tokens available; should be
> 13!
> 
> This would seem to indicate problems with make's jobserver pipe.  I've
> already found two bugs in patch 4, but I'm still seeing this error
> once in a while.
> 
> I'll send a v2 if/when I find the problem.

Either way, you're collecting goldstars like crazy here :)


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer


signature.asc
Description: PGP signature


Re: [PATCH] cygcheck: expand common_apps list

2019-06-03 Thread Corinna Vinschen
On May 27 00:50, Yaakov Selkowitz wrote:
> On Sun, 2019-05-26 at 00:49 -0600, Brian Inglis wrote:
> > To a degree, depends on installed Cygwin packages and Windows features, but 
> > I
> > also have in both Cygwin /{,{,usr/}s}bin and 
> > /Windows/{,System32{,/OpenSSH}/:
> > 
> > {"certutil", 0},
> > {"comp", 0},
> > {"ftp", 0},
> > {"scp", 0},
> > {"sftp", 0},
> > {"sftp-server", 0},
> > {"shutdown", 0},
> > {"ssh-add", 0},
> > {"ssh-agent", 0},
> > {"sshd", 0},
> > {"ssh-keygen", 0},
> > {"ssh-keyscan", 0},
> > 
> > from ls *.exe | sort in each set of dirs then join both.
> 
> I don't have /Windows/OpenSSH on my system.  Is it added to PATH when
> present?
> 
> --
> Yaakov

Brian?  Ping?


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer


signature.asc
Description: PGP signature


Re: [rebase PATCH] Introduce --merge-files (-M) flag (WAS: Introduce --no-rebase flag)

2019-06-03 Thread Corinna Vinschen
On May  6 10:31, Michael Haubenwallner wrote:
> 
> On 5/4/19 4:33 PM, Brian Inglis wrote:
> > On 2019-05-03 09:32, Michael Haubenwallner wrote:
> >> On 4/12/19 8:03 PM, Corinna Vinschen wrote:
> >>> On Apr 12 15:52, Michael Haubenwallner wrote:
>  The --no-rebase flag is to update the database for new files, without
> >>> Wouldn't something like --merge-files be more descriptive?
> >> What about --recognize ?
> > 
> > "The --recognize flag is to update the database for new files, without
> > performing a rebase.  The file names provided should have been rebased
> > using the --oblivious flag just before."
> > 
> > Recognize does not mean record or update in English but see, identify, or
> > acknowledge.
> > 
> > Your earlier suggestion of --record, the verb used in the comment quoted 
> > above
> > --update, or CV's suggestion --merge-files would make sense and be more
> > descriptive.
> 
> On a first thought, "merge files" does have a different meaning in the Gentoo
> context already, as in "merge files from staging directory into the live file
> system".
> However, on a second thought, "rebase --merge-files" is performed afterwards,
> but still part of that "merge files" phase, so the name does actually fit.
> 
> Patch updated.

Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer


signature.asc
Description: PGP signature