Re: Cygwin package search and cygcheck -p urlencoding still broken on new web server

2020-07-15 Thread Brian Inglis
On 2020-07-15 14:13, Marco Atzeri via Cygwin wrote:
> Problem: I want to search for
>    libssh/libssh.h
> Using https://cygwin.com/packages/
> If I put the name and press Go the URL is changed in
> https://cygwin.com/cgi-bin2/package-grep.cgi?grep=libssh%2Flibssh.h=x86_64
> and the output is
>    Found 0 matches for libsshx2Flibssh.h
>  ^^^
> Instead if I modify directly the URL in:
> https://cygwin.com/cgi-bin2/package-grep.cgi?grep=libssh/libssh.h=x86_64
> Found 3 matches for libssh/libssh.h
> 
> I guess that the current incapability is due to spurious urlencode in
> cgi-bin2/package-grep.cgi
> that is modifing the $param_grep
> echo ''$file' - '$desc''
> Could someone double check my guess ?

No change since your report on May 2nd, and my cross-post to overseers:

https://cygwin.com/pipermail/cygwin/2020-May/244684.html

https://sourceware.org/pipermail/overseers/2020q2/017115.html

where Frank suggested replacing badly urlencoded characters by ".":

$ cygcheck -p libssh/libssh.h
Found 0 matches for libsshx2flibssh.h
$ cygcheck -p libssh.libssh.h
Found 3 matches for libssh.libssh.h
libssh-devel-0.7.3-1 - libssh-devel: SSH implementation library (installed
binaries and support files)
libssh-devel-0.7.5-1 - libssh-devel: SSH implementation library
libssh-devel-0.8.7-1 - libssh-devel: SSH implementation library

The previous break appears to have been fixed by or due to Achim:

https://cygwin.com/pipermail/cygwin/2019-November/243112.html

Ping Achim?!

-- 
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.
[Data in IEC units and prefixes, physical quantities in SI.]
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Re: need to fix permissions

2020-07-15 Thread briand
On Wed, 15 Jul 2020 07:49:30 -0600
Bill Stewart  wrote:

> On Tue, Jul 14, 2020 at 6:34 PM  wrote:
> 
> the cygwin home folder is giving me a LOT of trouble with access denied.
> >
> > i've tried takeown and icacls to fix permissions, and strangely it worked
> > for _Some_ files, but i still have files which i need to back up which are
> > causing "access denied" errors.
> >
> > i'm hoping someone who understands how cygwin has set permissions can give
> > me a way to fix-up the permissions in ntfs land.
> >  
> 
> The following is what I have used successfully in the past and should reset
> everything:
> 
> 1. Open an elevated PowerShell or cmd.exe shell
> 
> 2. Take ownership to Administrators group:
> 
> takeown /F "C:\cygwin" /A /R /D Y
> 
> 3. Reset all file permissions:
> 
> icacls "C:\cygwin" /reset /T /C
> 
> 4. Reset the file attributes:
> 
> attrib -h -r -s "C:cygwin\*" /s
> 

Thank you very much !

I didn't see anybody mention that attrib step, in all the _many_ docs that i 
read.



-- 
Brian

--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Broken search on webserver

2020-07-15 Thread Marco Atzeri via Cygwin



Problem: I want to search for
   libssh/libssh.h

Using https://cygwin.com/packages/

If I put the name and press Go the URL is changed in
https://cygwin.com/cgi-bin2/package-grep.cgi?grep=libssh%2Flibssh.h=x86_64
^^^

and the output is
   Found 0 matches for libsshx2Flibssh.h
 ^^^


Instead if I modify directly the URL in:
https://cygwin.com/cgi-bin2/package-grep.cgi?grep=libssh/libssh.h=x86_64

Found 3 matches for libssh/libssh.h



I guess that the current incapability is due to spurious urlencode in
cgi-bin2/package-grep.cgi
that is modifing the $param_grep

echo ''$file' - '$desc''



Could someone double check my guess ?

Regards
Marco
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


[PATCH] Fix poll/select signal socket as write ready on connect failure

2020-07-15 Thread Marc Hoersken via Cygwin

Hello everyone,

I identified an issue related to the way the events FD_CONNECT and 
FD_CLOSE returned by WSAEnumNetworkEvents are currently handled in 
winsup/cygwin/fhandler_socket_inet.cc.


It seems like the code does not handle the fact that those events are 
returned only once for a socket and if not acted upon by the calling 
program may not be received again. This means poll and select are 
currently not consistend about the socket still being writable after a 
connect failure. The first call to poll or select would signal the 
socket as writable, but not any following call. The first call consumes 
the FD_CONNECT and FD_CLOSE events, regardless of the event mask 
supplied by the calling program. So even if the calling program does not 
care about writability in the first call, the events are consumed and 
following calls checking for writability will not be able to detect a 
connection failure.


A very simple test to reproduce can be made with the Cygwin provided 
curl package. After installing with current Cygwin, issue the following 
command to make it try connecting to a local non-listening port (eg. 47):


curl -v 127.0.0.1:47

With current Cygwin this will never timeout. An explanation of the curl 
internals can be found here [1], but the short version is: curl waits on 
sockets without checking/handling writability in a first poll call and 
then after waiting, the writability (connection failure) is checked in a 
second poll call per wait-loop iteration. Therefore curl can never 
detect the connection failure in the second call, because the first call 
already consumed the relevant events.


As far as I understand calling poll and/or select should not 
change/reset the socket readyness state, therefore I created a simple 
fix which could be used to solve this issue. Attached you will find a 
suggested patch to make sure poll and select always signal writability 
of a connection failed socket. With this patch applied the above example 
command failed with a "Connection refused" as expected.


This patch only fixes the behaviour regarding connection failure (during 
FD_CONNECT), I am not sure if connection closure (during FD_CLOSE) is 
also affected, but I was not able to find code handling the fact that 
FD_CLOSE is only signalled once.


Please take a look and thanks in advance!

Best regards,
Marc Hörsken

[1] https://github.com/curl/curl/pull/5509#issuecomment-658357933

From 7cd9d597a2a314c3aeb5b7c8aaa970ded6d56d7a Mon Sep 17 00:00:00 2001
From: Marc Hoersken 
Date: Wed, 15 Jul 2020 20:53:21 +0200
Subject: [PATCH] Cygwin: make sure failed sockets always signal writability

Since FD_CONNECT is only given once, we manually need to set
FD_WRITE for connection failed sockets to have consistent
behaviour in programs calling poll/select multiple times.

Example test to non-listening port: curl -v 127.0.0.1:47
---
 winsup/cygwin/fhandler_socket_inet.cc | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/winsup/cygwin/fhandler_socket_inet.cc 
b/winsup/cygwin/fhandler_socket_inet.cc
index 74c415d..e5b0d2d 100644
--- a/winsup/cygwin/fhandler_socket_inet.cc
+++ b/winsup/cygwin/fhandler_socket_inet.cc
@@ -376,6 +376,12 @@ fhandler_socket_wsock::evaluate_events (const long 
event_mask, long ,
   if (erase)
wsock_events->events &= ~(events & ~(FD_WRITE | FD_CLOSE));
 }
+  /* Since FD_CONNECT is only given once, we manually need to set
+ FD_WRITE for connection failed sockets to have consistent
+ behaviour in programs calling poll/select multiple times.
+ Example test to non-listening port: curl -v 127.0.0.1:47 */
+  if ((connect_state () == connect_failed) && (event_mask & FD_WRITE))
+wsock_events->events |= FD_WRITE;
   UNLOCK_EVENTS;
 
   return ret;
-- 
2.7.4

--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple


Re: need to fix permissions

2020-07-15 Thread Bill Stewart
On Tue, Jul 14, 2020 at 6:34 PM  wrote:

the cygwin home folder is giving me a LOT of trouble with access denied.
>
> i've tried takeown and icacls to fix permissions, and strangely it worked
> for _Some_ files, but i still have files which i need to back up which are
> causing "access denied" errors.
>
> i'm hoping someone who understands how cygwin has set permissions can give
> me a way to fix-up the permissions in ntfs land.
>

The following is what I have used successfully in the past and should reset
everything:

1. Open an elevated PowerShell or cmd.exe shell

2. Take ownership to Administrators group:

takeown /F "C:\cygwin" /A /R /D Y

3. Reset all file permissions:

icacls "C:\cygwin" /reset /T /C

4. Reset the file attributes:

attrib -h -r -s "C:cygwin\*" /s

Bill
--
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple