Re: cygstart: buffer overflow when a URI is passed (cygutils-1.4.17-[23])

2025-04-12 Thread Christian Franke via Cygwin

ggl329 via Cygwin wrote:

Hi all,

I've encountered a possible bug in cygstart.
It seems to abort when a URI is passed to it.


$ cygcheck -dc | grep cygutils
cygutils    1.4.17-3
$ cygstart https://www.google.com
*** buffer overflow detected ***: terminated
Aborted


Possibly no regression but longstanding bug which is now detected thanks 
to gcc12's __builtin_dynamic_object_size() feature and -D_FORTIFY_SOURCE=3:


cygstart.c:

cygstart_mbs_to_wcs (const char *mbs_path, wchar_t **wcs_path)
{
  ...
  *wcs_path = (wchar_t *) malloc ((len + 1) * sizeof (wchar_t));
  ...
  // *** buffer overflow detected *** because the length parameter
  // should specify the number of characters instead of bytes:
  if (mbstowcs (*wcs_path, mbs_path, (len + 1) * sizeof (wchar_t)) ...
  ...
}


--
Regards,
Christian


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


/dev/null regression in Cygwin 3.6.1

2025-04-12 Thread Bruno Haible via Cygwin
Hi,

In Gnulib, we have a unit test that compiles the program below as a
native Windows program (either with mingw or with MSVC), that exercises
the Gnulib select() function
  


Then it does (in a Cygwin shell):

  rm -f t-select-in.tmp
  ./test-select-fd.exe r 0 t-select-in.tmp < /dev/null
  cat t-select-in.tmp

Up to Cygwin 3.6.0, the contents of the file t-select-in.tmp was "1",
like on most other OSes, indicating that the program can read() from
file descriptor 0.

In Cygwin 3.6.1, the contents of the file t-select-in.tmp is "0",
indicating that read()ing from file descriptor 0 would block.
This is a regression.

Looking through the commits between 3.6.0 and 3.6.1, the most likely culprit
is commit d750786e7de013b58e2968eeb6a7fd59dcc535c9 .

Bruno


=== test-select-fd.c ===
#include 

#include 
#include 
#include 

int
main (int argc, char *argv[])
{
  if (argc == 4)
{
  char mode = argv[1][0];

  if (mode == 'r' || mode == 'w')
{
  int fd = atoi (argv[2]);

  if (fd >= 0)
{
  const char *result_file_name = argv[3];
  FILE *result_file = fopen (result_file_name, "wb");

  if (result_file != NULL)
{
  fd_set fds;
  struct timeval timeout;
  int ret;

  FD_ZERO (&fds);
  FD_SET (fd, &fds);
  timeout.tv_sec = 0;
  timeout.tv_usec = 1;
  ret = (mode == 'r'
 ? select (fd + 1, &fds, NULL, NULL, &timeout)
 : select (fd + 1, NULL, &fds, NULL, &timeout));
  if (ret < 0)
{
  perror ("select failed");
  exit (1);
}
  if ((ret == 0) != ! FD_ISSET (fd, &fds))
{
  fprintf (stderr, "incorrect return value\n");
  exit (1);
}
  fprintf (result_file, "%d\n", ret);
  exit (0);
}
}
}
}
  fprintf (stderr, "Usage: test-select-fd mode fd result-file-name\n");
  exit (1);
}





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


cygstart: buffer overflow when a URI is passed (cygutils-1.4.17-[23])

2025-04-12 Thread ggl329 via Cygwin

Hi all,

I've encountered a possible bug in cygstart.
It seems to abort when a URI is passed to it.


$ cygcheck -dc | grep cygutils
cygutils1.4.17-3
$ cygstart https://www.google.com
*** buffer overflow detected ***: terminated
Aborted

$ cygcheck -dc | grep cygutils
cygutils1.4.17-2
$ cygstart https://www.google.com
*** buffer overflow detected ***: terminated
Aborted

$ cygcheck -dc | grep cygutils
cygutils1.4.17-1
$ cygstart https://www.google.com
# Default browser opens up Google's site.


--
   ggl...@gmail.com


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


mksetupini aborts if run by a normal user

2025-04-12 Thread ggl329 via Cygwin

Hi Jon,

Thanks for updating calm package.

Usually, I work as a normal user. (i.e., not as root or an administrator)
In this case, mksetupini aborts with a permission error.
It is because Python library files do not have permission to normal users.
Could you modify the file permissions so that they are accessible to 
non-privileged users?

$ cygcheck -dc | grep calm
calm20250329-1

$ mksetupini
Traceback (most recent call last):
  File "/usr/bin/mksetupini", line 5, in 
from calm.mksetupini import main
  File "", line 1007, in _find_and_load
  File "", line 986, in _find_and_load_unlocked
  File "", line 680, in _load_unlocked
  File "", line 846, in exec_module
  File "", line 982, in get_code
  File "", line 1039, in get_data
PermissionError: [Errno 13] Permission denied: 
'/usr/lib/python3.9/site-packages/calm/__init__.py'

$ ls -ld /usr/lib/python3.9/site-packages/calm
drwxrwx--- 1 root Administrators 0 Apr 12 23:23 
/usr/lib/python3.9/site-packages/calm

$ ls -ld /usr/share/doc/calm
drwxrwx--- 1 root Administrators 0 Apr 12 23:23 /usr/share/doc/calm


--
  ggl...@gmail.com


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


Cygwin fork error

2025-04-12 Thread Siva kumar via Cygwin
Hi all,
My Cygwin was working perfectly until yesterday. I installed Python 3.13
and pip and Ansible through Win powershell. I think this corrupted cygwin.
Now Cygwin is giving fork errors :

54936743 [main] bash 161 dofork: child -1 - forked process 17848 died
unexpectedly, retry 0, exit code 0xC142, errno 11
bash: fork: retry: Resource temporarily unavailable
56102787 [main] bash 161 dofork: child -1 - forked process 17416 died
unexpectedly, retry 0, exit code 0xC142, errno 11
bash: fork: retry: Resource temporarily unavailable
58266876 [main] bash 161 dofork: child -1 - forked process 9256 died
unexpectedly, retry 0, exit code 0xC142, errno 11
bash: fork: retry: Resource temporarily unavailable
bash: fork: Resource temporarily unavailable

No cmds are working. Rebasing also not working. Everything shows above
error.
I tried installing again using setup_x64.exe, but no use.
Can anyone suggest what should be done?
Should I uninstall python [windows version]?

-Rgds siva

-- 
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: Cygwin fork error

2025-04-12 Thread Siva kumar via Cygwin
This issue was resolved after a pc restart, thanx.

On Sun, 13 Apr 2025 at 09:07, Siva kumar  wrote:

> Hi all,
> My Cygwin was working perfectly until yesterday. I installed Python 3.13
> and pip and Ansible through Win powershell. I think this corrupted cygwin.
> Now Cygwin is giving fork errors :
>
> 54936743 [main] bash 161 dofork: child -1 - forked process 17848 died
> unexpectedly, retry 0, exit code 0xC142, errno 11
> bash: fork: retry: Resource temporarily unavailable
> 56102787 [main] bash 161 dofork: child -1 - forked process 17416 died
> unexpectedly, retry 0, exit code 0xC142, errno 11
> bash: fork: retry: Resource temporarily unavailable
> 58266876 [main] bash 161 dofork: child -1 - forked process 9256 died
> unexpectedly, retry 0, exit code 0xC142, errno 11
> bash: fork: retry: Resource temporarily unavailable
> bash: fork: Resource temporarily unavailable
>
> No cmds are working. Rebasing also not working. Everything shows above
> error.
> I tried installing again using setup_x64.exe, but no use.
> Can anyone suggest what should be done?
> Should I uninstall python [windows version]?
>
> -Rgds siva
>

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