Mintty/tmux hangs for 1 minute on startup - seems to be a forking issue

2020-01-31 Thread Anon User via cygwin
I first reported this problem to the Mintty project at GitHub.  With their 
help, I was able to debug the issue to the call to forkpty.  I installed tmux 
and found it also hangs the exact same way.  My guess is any process which 
makes this fork call will hang in a similar way. Rather than copy/paste the 
thread, I'd rather just refer you to there : 
https://github.com/mintty/mintty/issues/960

I will also direct link to the strace log I made which includes my comment 
showing where the hang happens:
https://github.com/mintty/mintty/files/4136651/mintty.strace.log (Line 718 is 
the hanging point.)

Also Windows 10's analyze wait chain function in TaskManager shows the process 
waiting for Network I/O, but we see no evidence of network activity. 
https://i.imgur.com/Uiw9laH.png

I haven't seen any other windows applications hang thusly, so I'm at a loss for 
what I've done to my windows system to have caused this. Otherwise, I'd expect 
others to share my pain.  Any ideas?

cygcheck.out
Description: Binary data

--
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

[PATCH v2] Cygwin: console: Revise color setting codes in legacy console mode.

2020-01-31 Thread Takashi Yano
- With this patch, foreground color and background color are allowed
  to be set simultaneously by 24 bit color escape sequence such as
  ESC[38;2;0;0;255;48;2;128;128;0m in legacy console mode.
---
 winsup/cygwin/fhandler.h  |  2 +-
 winsup/cygwin/fhandler_console.cc | 47 ++-
 2 files changed, 28 insertions(+), 21 deletions(-)

diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 80a78d14c..608932c9c 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -1829,7 +1829,7 @@ enum ansi_intensity
 #define gotrparen 9
 #define eatpalette 10
 #define endpalette 11
-#define MAXARGS 10
+#define MAXARGS 16
 
 enum cltype
 {
diff --git a/winsup/cygwin/fhandler_console.cc 
b/winsup/cygwin/fhandler_console.cc
index f88d24701..38eed05f4 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -1952,7 +1952,7 @@ fhandler_console::char_command (char c)
   switch (c)
 {
 case 'm':   /* Set Graphics Rendition */
-   for (int i = 0; i <= con.nargs; i++)
+   for (int i = 0; i < con.nargs; i++)
 switch (con.args[i])
   {
 case 0:/* normal color */
@@ -2020,38 +2020,39 @@ fhandler_console::char_command (char c)
   con.fg = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED;
   break;
 case 38:
-  if (con.nargs < 1)
+  if (con.nargs < i + 2)
 /* Sequence error (abort) */
 break;
-  switch (con.args[1])
+  switch (con.args[i + 1])
 {
 case 2:
-  if (con.nargs != 4)
+  if (con.nargs < i + 5)
 /* Sequence error (abort) */
 break;
-  r = con.args[2];
-  g = con.args[3];
-  b = con.args[4];
+  r = con.args[i + 2];
+  g = con.args[i + 3];
+  b = con.args[i + 4];
   r = r < (95 + 1) / 2 ? 0 : r > 255 ? 5 : (r - 55 + 20) / 40;
   g = g < (95 + 1) / 2 ? 0 : g > 255 ? 5 : (g - 55 + 20) / 40;
   b = b < (95 + 1) / 2 ? 0 : b > 255 ? 5 : (b - 55 + 20) / 40;
   con.fg = table256[16 + r*36 + g*6 + b];
+  i += 4;
   break;
 case 5:
-  if (con.nargs != 2)
+  if (con.nargs < i + 3)
 /* Sequence error (abort) */
 break;
   {
-int idx = con.args[2];
+int idx = con.args[i + 2];
 if (idx < 0)
   idx = 0;
 if (idx > 255)
   idx = 255;
 con.fg = table256[idx];
+i += 2;
   }
   break;
 }
-  i += con.nargs;
   break;
 case 39:
   con.fg = con.default_color & FOREGROUND_ATTR_MASK;
@@ -2081,38 +2082,39 @@ fhandler_console::char_command (char c)
   con.bg = BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED;
   break;
 case 48:
-  if (con.nargs < 1)
+  if (con.nargs < i + 2)
 /* Sequence error (abort) */
 break;
-  switch (con.args[1])
+  switch (con.args[i + 1])
 {
 case 2:
-  if (con.nargs != 4)
+  if (con.nargs < i + 5)
 /* Sequence error (abort) */
 break;
-  r = con.args[2];
-  g = con.args[3];
-  b = con.args[4];
+  r = con.args[i + 2];
+  g = con.args[i + 3];
+  b = con.args[i + 4];
   r = r < (95 + 1) / 2 ? 0 : r > 255 ? 5 : (r - 55 + 20) / 40;
   g = g < (95 + 1) / 2 ? 0 : g > 255 ? 5 : (g - 55 + 20) / 40;
   b = b < (95 + 1) / 2 ? 0 : b > 255 ? 5 : (b - 55 + 20) / 40;
   con.bg = table256[16 + r*36 + g*6 + b] << 4;
+  i += 4;
   break;
 case 5:
-  if (con.nargs != 2)
+  if (con.nargs < i + 3)
 /* Sequence error (abort) */
 break;
   {
-int idx = con.args[2];
+int idx = con.args[i + 2];
 if (idx < 0)
   idx = 0;
 if (idx > 255)
   idx = 255;
 con.bg = table256[idx] << 4;
+i += 2;
   }
   break;
 }
-  i += con.nargs;
   break;
 case 49:
   con.bg = con.default_color & 

[PATCH] Cygwin: console: Revise color setting codes in legacy console mode.

2020-01-31 Thread Takashi Yano
- With this patch, foreground color and background color are allowed
  to be set simultaneously by escape sequence such as
  ESC[38;2;0;0;255;48;2;128;128;0m in legacy console mode.
---
 winsup/cygwin/fhandler_console.cc | 38 ---
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/winsup/cygwin/fhandler_console.cc 
b/winsup/cygwin/fhandler_console.cc
index f88d24701..e2832dad8 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -2020,38 +2020,39 @@ fhandler_console::char_command (char c)
   con.fg = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED;
   break;
 case 38:
-  if (con.nargs < 1)
+  if (con.nargs < i + 1)
 /* Sequence error (abort) */
 break;
-  switch (con.args[1])
+  switch (con.args[i + 1])
 {
 case 2:
-  if (con.nargs != 4)
+  if (con.nargs < i + 4)
 /* Sequence error (abort) */
 break;
-  r = con.args[2];
-  g = con.args[3];
-  b = con.args[4];
+  r = con.args[i + 2];
+  g = con.args[i + 3];
+  b = con.args[i + 4];
   r = r < (95 + 1) / 2 ? 0 : r > 255 ? 5 : (r - 55 + 20) / 40;
   g = g < (95 + 1) / 2 ? 0 : g > 255 ? 5 : (g - 55 + 20) / 40;
   b = b < (95 + 1) / 2 ? 0 : b > 255 ? 5 : (b - 55 + 20) / 40;
   con.fg = table256[16 + r*36 + g*6 + b];
+  i += 4;
   break;
 case 5:
-  if (con.nargs != 2)
+  if (con.nargs < i + 2)
 /* Sequence error (abort) */
 break;
   {
-int idx = con.args[2];
+int idx = con.args[i + 2];
 if (idx < 0)
   idx = 0;
 if (idx > 255)
   idx = 255;
 con.fg = table256[idx];
+i += 2;
   }
   break;
 }
-  i += con.nargs;
   break;
 case 39:
   con.fg = con.default_color & FOREGROUND_ATTR_MASK;
@@ -2081,38 +2082,39 @@ fhandler_console::char_command (char c)
   con.bg = BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED;
   break;
 case 48:
-  if (con.nargs < 1)
+  if (con.nargs < i + 1)
 /* Sequence error (abort) */
 break;
-  switch (con.args[1])
+  switch (con.args[i + 1])
 {
 case 2:
-  if (con.nargs != 4)
+  if (con.nargs < i + 4)
 /* Sequence error (abort) */
 break;
-  r = con.args[2];
-  g = con.args[3];
-  b = con.args[4];
+  r = con.args[i + 2];
+  g = con.args[i + 3];
+  b = con.args[i + 4];
   r = r < (95 + 1) / 2 ? 0 : r > 255 ? 5 : (r - 55 + 20) / 40;
   g = g < (95 + 1) / 2 ? 0 : g > 255 ? 5 : (g - 55 + 20) / 40;
   b = b < (95 + 1) / 2 ? 0 : b > 255 ? 5 : (b - 55 + 20) / 40;
   con.bg = table256[16 + r*36 + g*6 + b] << 4;
+  i += 4;
   break;
 case 5:
-  if (con.nargs != 2)
+  if (con.nargs < i + 2)
 /* Sequence error (abort) */
 break;
   {
-int idx = con.args[2];
+int idx = con.args[i + 2];
 if (idx < 0)
   idx = 0;
 if (idx > 255)
   idx = 255;
 con.bg = table256[idx] << 4;
+i += 2;
   }
   break;
 }
-  i += con.nargs;
   break;
 case 49:
   con.bg = con.default_color & BACKGROUND_ATTR_MASK;
-- 
2.21.0



Re: Is there a way to clone-install Cygwin?

2020-01-31 Thread Brian Inglis
On 2020-01-31 12:21, Achim Gratz wrote:
> Ulli Horlacher writes:
>>> To a new naked Windows box, if you can "mount" it over the network
>>
>> No, I cannot do that. My destination Windows hosts are behind firewalls.
>> They cannot mount anything. I have to transfer a container file.
> 
> Try a vhdx maybe?
Works only on some editions, flavours, features.

Format a USB drive as NTFS, copy the Cygwin directory tree verbatim onto that,
then copy the Cygwin directory tree verbatim onto the destination system.
You should use a common (admin?) owner, and a common (guest?) user if you want
to preset a home dir.

You could set everything up in a single tree including packages and setup so
that you could do reinstalls if required.

-- 
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.

--
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



Re: Is there a way to clone-install Cygwin?

2020-01-31 Thread Achim Gratz
Ulli Horlacher writes:
>> To a new naked Windows box, if you can "mount" it over the network
>
> No, I cannot do that. My destination Windows hosts are behind firewalls.
> They cannot mount anything. I have to transfer a container file.

Try a vhdx maybe?


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf rackAttack V1.04R1:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

--
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



Re: hardlinks on directories?

2020-01-31 Thread Brian Inglis
On 2020-01-31 03:17, Ulli Horlacher wrote:
> On Thu 2020-01-30 (12:26), Eric Blake wrote:
> 
>>> Are this directory hard links?
>>
>> No, rather they are parallel mount points (the same directory mounted 
>> under two different names).
> 
> /: mount
> C:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
> C:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
> C:/cygwin64 on / type ntfs (binary,auto)
> C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)
> 
> That's it! Thanks!
> 
> But why does Cygwin mount the directories /usr/bin and /usr/lib extra?

$ cmd /c dir `cygpath -aw /usr`
...
2020-01-30  17:51  include
2020-01-19  13:55  libexec
2019-09-29  13:38  local
2020-01-19  13:55  sbin
2020-01-19  13:56  share
2016-10-25  14:43  src
2019-12-18  11:07  tmp
...

No /usr/bin nor /usr/lib.

> Why not a symbolic link?

Mounts ensure the paths exist and are identical to /bin /lib.

> And which process does this mounting?

Every Cygwin process at startup performs those mounts and any alternatives in
/etc/fstab and /etc/fstab.d/*, see "Cygwin User's Guide", Chapter 3. Using
Cygwin, /The Cygwin Mount Table/:

http://cygwin.com/cygwin-ug-net/using.html#mount-table

-- 
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.

--
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



Re: Is there a way to clone-install Cygwin?

2020-01-31 Thread Ulli Horlacher
On Fri 2020-01-31 (08:06), KARL BOTTS wrote:
> 
> >>> Cygwin is totally portable! You can simply copy the installation folder to
> >>> another PC, copy the shortcut (edit target if needed) and it will work.
> 
> >> How do you copy it?
> >> Which archive container do you use?
> 
> I have been using this approach for years.
> 
> To a new naked Windows box, if you can "mount" it over the network

No, I cannot do that. My destination Windows hosts are behind firewalls.
They cannot mount anything. I have to transfer a container file.


> Be sure to use 64-bit cygwin.  The 32-bit used to work, but now and then
> I would have to fuss with "rebase".  I have never had that problem with
> the 64-bit.  

I have only 64 bit systems. Alls 32 bit systems are gone.

-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum TIK 
Universitaet Stuttgart E-Mail: horlac...@tik.uni-stuttgart.de
Allmandring 30aTel:++49-711-68565868
70569 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
REF:<424yaeofi7856set.1580479...@web03.cms.usa.net>

--
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



Re: Is there a way to clone-install Cygwin?

2020-01-31 Thread Ulli Horlacher
On Fri 2020-01-31 (13:54), Thomas Wolff wrote:
> 
> On 31.01.2020 12:29, Ulli Horlacher wrote:
> 
> > On Fri 2020-01-31 (11:24), Ulli Horlacher wrote:
> >
> >> On Mon 2020-01-20 (19:28), Brent Epp wrote:
> >>
> >>> Cygwin is totally portable! You can simply copy the installation folder to
> >>> another PC, copy the shortcut (edit target if needed) and it will work.
> >> How do you copy it?
> >> Which archive container do you use?
> 
> On the source system, within cygwin, zip up everything you want, with 
> option -y:
> cd /; zip -ry cygwin . -x home
> or
> cd /cygdrive/c; zip -ry cygwin cygwin64 -x ...

Ok, I did that.
But:


> On the target system, install a minimal cygwin unzipping environment:
> copy files unzip.exe, cygwin1.dll, cygbz2-1.dll into a subdirectory 
> called bin
> 
> Use that unzip to unpack your zip file. Voilà!

This is way to complicated for my users, they cannot handle it.

I tried to write an installer.bat which uses the Windows bsdtar, but it
fails with:



C:\>dir
 Volume in drive C has no label.
 Volume Serial Number is EC42-8D26

 Directory of C:\

31 Jan 2020  12:4584.340.162 cygwin64.tgz
31 Jan 2020  14:3891.960.715 cygwin64.zip
31 Jan 2020  12:4545 cygwin64_addons.tgz
19 Mar 2019  05:52  PerfLogs
13 Jan 2020  13:12  Program Files
15 Jan 2020  17:32  Program Files (x86)
13 Jan 2020  13:12  Users
13 Jan 2020  14:46  Windows
31 Jan 2020  13:59  xx
31 Jan 2020  14:4391.960.889 xxx_20200131_144048.zip
   4 File(s)268.261.811 bytes
   6 Dir(s)  45.442.043.904 bytes free

C:\>tar -xf cygwin64.zip
cygwin64/bin/apropos: Can't create '?\\C:cygwin64\\bin\\apropos'
cygwin64/bin/awk: Can't create '?\\C:cygwin64\\bin\\awk'
cygwin64/bin/bzcmp: Can't create '?\\C:cygwin64\\bin\\bzcmp'
cygwin64/bin/bzegrep: Can't create '?\\C:cygwin64\\bin\\bzegrep'
cygwin64/bin/bzfgrep: Can't create '?\\C:cygwin64\\bin\\bzfgrep'
cygwin64/bin/bzless: Can't create '?\\C:cygwin64\\bin\\bzless'
cygwin64/bin/captoinfo: Can't create '?\\C:cygwin64\\bin\\captoinfo'
^C
C:\>

(I run it as administrator).

Any idea what went wrong and how I can fix it?



-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum TIK 
Universitaet Stuttgart E-Mail: horlac...@tik.uni-stuttgart.de
Allmandring 30aTel:++49-711-68565868
70569 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
REF:<5cc67e71-0edf-90a2-3601-50affd5c1...@towo.net>

--
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



Re: Is there a way to clone-install Cygwin?

2020-01-31 Thread KARL BOTTS


>>> Cygwin is totally portable! You can simply copy the installation folder
to
>>> another PC, copy the shortcut (edit target if needed) and it will work.

>> How do you copy it?
>> Which archive container do you use?

I have been using this approach for years.

To a new naked Windows box, if you can "mount" it over the network, e.g., map
a drive letter to it, then you can use cygwin tools from an existing box with
cygwin, to copy cygwin to the new.  I usually use cygwin tar, but I think 'cp
-a' will work.  I think in the past, I have used robocopy.  The key is the
links and symlinks: normal Windows tools won't get them right.

For upgrades, once cygwin is on both boxes, I always use tar.  I've got this
down to pretty much routine.  I do it once or twice a year.  I upgrade cygwin
on one box, vet it for a few days, then upgrade several others.  I untar into
an empty dir, then use native cmd.exe 'move' to swap the dirs.

Be sure to use 64-bit cygwin.  The 32-bit used to work, but now and then I
would have to fuss with "rebase".  I have never had that problem with the
64-bit.  


---
Karl Botts, kdbo...@usa.net


--
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



Re: Issue with email -a (Zip files)

2020-01-31 Thread Brian Inglis
On 2020-01-30 23:40, Priyanka Joshi wrote:
> On Friday, January 31, 2020 3:27 AM, Brian Inglis wrote:
>> On 2020-01-30 02:21, Priyanka Joshi wrote:
>>> I am facing issue when I am trying to send zip file as attachment, 
>>> same command works fine for xml file.
>>>
>>> PFB commands for reference:
>>>
>>> Below command worked fine and sent testng.xml as attachment email -s "BHN
>>> Test Automation Report" -a testng.xml priyanka.jo...@bhnetwork.com
>>>
>>> email -s "BHN Test Automation Report" -a allure-report.zip 
>>> priyanka.jo...@bhnetwork.com ==> Not triggering any email and not
>>> throwing any error.
>>>
>>> Please let us know how to debug and fix the zip attachment issue.

>> Cygwin email requires -b option flag, body text on stdin, or invokes your 
>> editor for body text entry to send emails.
>> First, check location, version, and test:
>> 
>>  $ which email
>>  /usr/bin/email
>>  $ email --version
>>  email - By Dean Jones; Version 3.2.3-git
>>  $ email -b -s "Test zip send" -a Downloads/zip above-email-address
>> 
>> worked for me, with a random downloaded small zip file, also worked whether
>> I echoed or redirected text into stdin, or did neither and typed body text
>> into the editor window opened on a tmp file.
>> 
>> Corporate networks often have filters and strict rules about what may be 
>> included in a zip file, may be both outgoing and incoming; they could even
>> have Outlook, other email client, or generic email filters on your desktop
>> system.
>> Talk to your IT mail and security admins to find out what is filtered where.
>> Try renaming the zip file as if xml or something safe, and see if that 
>> works, and if not, try putting your xml in a zip file, and see if that
>> works.

> Can you please let me know if there is any way to check SMTP error logs for 
> the email not getting sent.>
> I am trying to enable the logs but facing issue with inetmgr.dll and 
> smtpsnap.dll and not seeing SMTP option under IIS.>
> PFB updates on the steps shared:>
>> which email> /usr/bin/email>
>> email --version> email - By Dean Jones; Version 3.2.3-git>
> try putting your xml in a zip file, and see if that works. ==>It worked>
>> email -b -s "Test zip send" -a test.zip priyanka.jo...@bhnetwork.com>
> Try renaming the zip file as if xml or something safe>
> ==>Tried renaming to xml but email was not triggered, I will check with the 
> network team if there are any restrictions
Your email site or system configuration should be in /etc/email/email.conf where
you should configure your global system SMTP server characteristics,
authentication settings, sendmail location and options, gpg/2 location and
options, etc.;
you should copy these options into your personal configuration ~/.email.conf,
which overrides whether the global file /etc/email/email.conf is looked for,
where you should also configure your name, email and reply to addresses, .sig
file location, address book, authorization username and password, and email log
directory SAVE_SENT_MAIL (suggest using ~/.config/email/, ~/.email/ or perhaps
~/) in which email will create file email.sent, where you can see what email has
done.

When testing problematic files, add option flag -V, --verbose to see what email
thinks is happening.

-- 
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.

--
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



Re: Is there a way to clone-install Cygwin?

2020-01-31 Thread Thomas Wolff



On 31.01.2020 12:29, Ulli Horlacher wrote:

On Fri 2020-01-31 (11:24), Ulli Horlacher wrote:


On Mon 2020-01-20 (19:28), Brent Epp wrote:


Cygwin is totally portable! You can simply copy the installation folder to
another PC, copy the shortcut (edit target if needed) and it will work.

How do you copy it?
Which archive container do you use?
On the source system, within cygwin, zip up everything you want, with 
option -y:

cd /; zip -ry cygwin . -x home
or
cd /cygdrive/c; zip -ry cygwin cygwin64 -x ...

On the target system, install a minimal cygwin unzipping environment:
copy files unzip.exe, cygwin1.dll, cygbz2-1.dll into a subdirectory 
called bin


Use that unzip to unpack your zip file. Voilà!

--
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



[newlib-cygwin] Cygwin: fstat_helper: always use handle in call to get_file_attribute

2020-01-31 Thread Ken Brown
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=76dca77f049271e2529c25de8a396e65dbce615d

commit 76dca77f049271e2529c25de8a396e65dbce615d
Author: Ken Brown 
Date:   Thu Jan 30 10:08:21 2020 -0500

Cygwin: fstat_helper: always use handle in call to get_file_attribute

When fhandler_base::fstat_helper is called, the handle h returned by
get_stat_handle() should be pc.handle() and should be safe to use for
getting the file information.  Previously, the call to
get_file_attribute() for FIFOs set the first argument to NULL instead
of h, thereby forcing the file to be opened for fetching the security
descriptor in get_file_sd().

Diff:
---
 winsup/cygwin/fhandler_disk_file.cc | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/fhandler_disk_file.cc 
b/winsup/cygwin/fhandler_disk_file.cc
index f362e31..bc5967e 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -394,12 +394,13 @@ fhandler_base::fstat_fs (struct stat *buf)
   return res;
 }
 
+/* Called by fstat_by_handle and fstat_by_name. */
 int __reg2
 fhandler_base::fstat_helper (struct stat *buf)
 {
   IO_STATUS_BLOCK st;
   FILE_COMPRESSION_INFORMATION fci;
-  HANDLE h = get_stat_handle ();
+  HANDLE h = get_stat_handle ();  /* Should always be pc.handle(). */
   PFILE_ALL_INFORMATION pfai = pc.fai ();
   ULONG attributes = pc.file_attributes ();
 
@@ -475,8 +476,8 @@ fhandler_base::fstat_helper (struct stat *buf)
   else if (pc.issocket ())
 buf->st_mode = S_IFSOCK;
 
-  if (!get_file_attribute (is_fs_special () && !pc.issocket () ? NULL : h, pc,
-  >st_mode, >st_uid, >st_gid))
+  if (!get_file_attribute (h, pc, >st_mode, >st_uid,
+  >st_gid))
 {
   /* If read-only attribute is set, modify ntsec return value */
   if (::has_attribute (attributes, FILE_ATTRIBUTE_READONLY)


Re: Is there a way to clone-install Cygwin?

2020-01-31 Thread Ulli Horlacher
On Fri 2020-01-31 (12:29), Ulli Horlacher wrote:

> > On Mon 2020-01-20 (19:28), Brent Epp wrote:
> > 
> > > Cygwin is totally portable! You can simply copy the installation folder 
> > > to 
> > > another PC, copy the shortcut (edit target if needed) and it will work. 
> > 
> > I have tried it with:
> > 
> > /: cat zip.bat
> > cd C:\
> > \7z\7za a -tzip -xr!cygwin64/home/* -xr!cygwin64/var/log/* tmp\cygwin64.zip 
> > cygwin64
> 
> > Next problem is: the file permissions will not be restored.
> 
> And all symbolic links have been extracted as regular files :-(

Next try with tar container:

On the source host I used:

cd /cygdrive/c
tar --one-file-system --exclude=cygwin64/var/log/* --exclude=cygwin64/home/* 
-cvzf /cygdrive/c/tmp/cygwin64.tgz cygwin64

I transfered this cygwin64.tgz to the destintion host and tried to extract
it:

C:\>ver
Microsoft Windows [Version 10.0.18363.592]

C:\>tar --version
bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.5.f-ipp

C:\>tar -xzf cygwin64.tgz
cygwin64/bin/apropos: Can't create '?\\C:cygwin64\\bin\\apropos'
cygwin64/bin/awk: Can't create '?\\C:cygwin64\\bin\\awk'
cygwin64/bin/bzcmp: Can't create '?\\C:cygwin64\\bin\\bzcmp'
cygwin64/bin/bzegrep: Can't create '?\\C:cygwin64\\bin\\bzegrep'
cygwin64/bin/bzfgrep: Can't create '?\\C:cygwin64\\bin\\bzfgrep'
cygwin64/bin/bzless: Can't create '?\\C:cygwin64\\bin\\bzless'
cygwin64/bin/captoinfo: Can't create '?\\C:cygwin64\\bin\\captoinfo'
cygwin64/bin/dnsdomainname: Can't create 
'?\\C:cygwin64\\bin\\dnsdomainname'
cygwin64/bin/domainname: Can't create '?\\C:cygwin64\\bin\\domainname'
cygwin64/bin/ex: Can't create '?\\C:cygwin64\\bin\\ex'
cygwin64/bin/infotocap: Can't create '?\\C:cygwin64\\bin\\infotocap'
cygwin64/bin/lzcat: Can't create '?\\C:cygwin64\\bin\\lzcat'
cygwin64/bin/lzcmp: Can't create '?\\C:cygwin64\\bin\\lzcmp'
cygwin64/bin/lzdiff: Can't create '?\\C:cygwin64\\bin\\lzdiff'
cygwin64/bin/lzegrep: Can't create '?\\C:cygwin64\\bin\\lzegrep'
cygwin64/bin/lzfgrep: Can't create '?\\C:cygwin64\\bin\\lzfgrep'
cygwin64/bin/lzgrep: Can't create '?\\C:cygwin64\\bin\\lzgrep'
cygwin64/bin/lzless: Can't create '?\\C:cygwin64\\bin\\lzless'
cygwin64/bin/lzma: Can't create '?\\C:cygwin64\\bin\\lzma'
cygwin64/bin/lzmore: Can't create '?\\C:cygwin64\\bin\\lzmore'
cygwin64/bin/reset: Can't create '?\\C:cygwin64\\bin\\reset'
cygwin64/bin/rnano: Can't create '?\\C:cygwin64\\bin\\rnano'
cygwin64/bin/rvi: Can't create '?\\C:cygwin64\\bin\\rvi'
cygwin64/bin/rview: Can't create '?\\C:cygwin64\\bin\\rview'
cygwin64/bin/rvim: Can't create '?\\C:cygwin64\\bin\\rvim'
^C

(I have started the cmd shell as administrator)


-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum TIK 
Universitaet Stuttgart E-Mail: horlac...@tik.uni-stuttgart.de
Allmandring 30aTel:++49-711-68565868
70569 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
REF:<20200131112904.gc5...@tik.uni-stuttgart.de>

--
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



Re: [PATCH] Cygwin: fstat_helper: always use handle in call to get_file_attribute

2020-01-31 Thread Corinna Vinschen
On Jan 30 12:01, Ken Brown wrote:
> When fhandler_base::fstat_helper is called, the handle h returned by
> get_stat_handle() should be pc.handle() and should be safe to use for
> getting the file information.  Previously, the call to
> get_file_attribute() for FIFOs set the first argument to NULL instead
> of h, thereby forcing the file to be opened for fetching the security
> descriptor in get_file_sd().
> ---
>  winsup/cygwin/fhandler_disk_file.cc | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/winsup/cygwin/fhandler_disk_file.cc 
> b/winsup/cygwin/fhandler_disk_file.cc
> index f362e31e3..ad63af824 100644
> --- a/winsup/cygwin/fhandler_disk_file.cc
> +++ b/winsup/cygwin/fhandler_disk_file.cc
> @@ -394,13 +394,14 @@ fhandler_base::fstat_fs (struct stat *buf)
>return res;
>  }
>  
> +/* Called by fstat_by_handle and fstat_by_name. */
>  int __reg2
>  fhandler_base::fstat_helper (struct stat *buf)
>  {
>IO_STATUS_BLOCK st;
>FILE_COMPRESSION_INFORMATION fci;
> -  HANDLE h = get_stat_handle ();
> -  PFILE_ALL_INFORMATION pfai = pc.fai ();
> +  HANDLE h = get_stat_handle ();  /* Should always be pc.handle(). */
> +  pfile_all_information pfai = pc.fai ();

This lower-casing PFILE_ALL_INFORMATION looks like a typo.  Other than
that the patch looks ok.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer


signature.asc
Description: PGP signature


Re: Is there a way to clone-install Cygwin?

2020-01-31 Thread Ulli Horlacher
On Fri 2020-01-31 (11:24), Ulli Horlacher wrote:

> On Mon 2020-01-20 (19:28), Brent Epp wrote:
> 
> > Cygwin is totally portable! You can simply copy the installation folder to 
> > another PC, copy the shortcut (edit target if needed) and it will work. 
> 
> How do you copy it?
> Which archive container do you use?
> 
> I have tried it with:
> 
> /: cat zip.bat
> cd C:\
> \7z\7za a -tzip -xr!cygwin64/home/* -xr!cygwin64/var/log/* tmp\cygwin64.zip 
> cygwin64
> 
> But in resulting cygwin64.zip the directories /cygdrive /proc /usr/bin and 
> /usr/lib are
> missing, because they are mount points.

I have now extracted this cygwin64.zip on a second Windows host using the
Windows bsdtar
I have started a mintty with bash:

The missing mountpoint directories were created automagically :-)


> Next problem is: the file permissions will not be restored.

And all symbolic links have been extracted as regular files :-(


-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum TIK 
Universitaet Stuttgart E-Mail: horlac...@tik.uni-stuttgart.de
Allmandring 30aTel:++49-711-68565868
70569 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
REF:<20200131102434.gb5...@tik.uni-stuttgart.de>

--
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



Re: Is there a way to clone-install Cygwin?

2020-01-31 Thread Ulli Horlacher
On Mon 2020-01-20 (19:28), Brent Epp wrote:

> Cygwin is totally portable! You can simply copy the installation folder to 
> another PC, copy the shortcut (edit target if needed) and it will work. 

How do you copy it?
Which archive container do you use?

I have tried it with:

/: cat zip.bat
cd C:\
\7z\7za a -tzip -xr!cygwin64/home/* -xr!cygwin64/var/log/* tmp\cygwin64.zip 
cygwin64

But in resulting cygwin64.zip the directories /cygdrive /proc /usr/bin and 
/usr/lib are
missing, because they are mount points.

Next problem is: the file permissions will not be restored.


-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum TIK 
Universitaet Stuttgart E-Mail: horlac...@tik.uni-stuttgart.de
Allmandring 30aTel:++49-711-68565868
70569 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
REF:<16fc5b76c50.2780.a1382e26d1292f71ec6ef0cd03d49...@pdc.ca>

--
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



Re: hardlinks on directories?

2020-01-31 Thread Ulli Horlacher
On Thu 2020-01-30 (12:26), Eric Blake wrote:

> > Are this directory hard links?
> 
> No, rather they are parallel mount points (the same directory mounted 
> under two different names).

/: mount
C:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
C:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
C:/cygwin64 on / type ntfs (binary,auto)
C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)

That's it! Thanks!

But why does Cygwin mount the directories /usr/bin and /usr/lib extra?
Why not a symbolic link?
And which process does this mounting?


-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum TIK 
Universitaet Stuttgart E-Mail: horlac...@tik.uni-stuttgart.de
Allmandring 30aTel:++49-711-68565868
70569 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
REF:

--
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