procmon doesn't capture cygwin's process arguments

2020-11-01 Thread Oleksandr Gavenko via Cygwin
I tried to find out what processes emacs-w32 is starting for my custom
TRAMP method.

"strace -f emacs-w32" fails.

I expected to succeed with procmon & its filter " Command/ Process Start".

Unfortunately procmon [1] doesn't report "argv" if a Cygwin executable is
started from a Cygwin executable. If I run a Cygwin app from the Windows
environment it captures positional arguments.

Is there some option to make positional arguments visible to procmon?

I could find it in:

* https://cygwin.com/cygwin-ug-net/using-cygwinenv.html
* https://cygwin.com/cygwin-ug-net/setup-env.html

Please keep my email in CC...

[1] https://docs.microsoft.com/en-us/sysinternals/downloads/procmon
--
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: procmon doesn't capture cygwin's process arguments

2020-11-02 Thread Oleksandr Gavenko via Cygwin
Andrey Repin wrote:
> > * https://cygwin.com/cygwin-ug-net/using-cygwinenv.html
> Yes, it's in CYGWIN=wincmdln

Thx. So I was tired enough not to spot that option even when there is
a keyword "argv" on the page ((

> But it's not necessarily accurate.
> See the documentation for details.

Docs said:

(no)wincmdln - if set, the windows complete command line (truncated to ~32K)
will be passed on any processes that it creates in addition to the
normal UNIX argv list.
Defaults to not set.

So the presentation is not accurate if the length exceeds 32K. NP ))

At least I am not blind at what happens with processes. Tested, it works:

CYGWIN=wincmdln emacs-w32 -Q

The first process doesn't report its argv, but all children do.

The solution of Brian Inglis (of using "ps" or "/proc/*/cmdline") is
not viable in situations when
processes start and die quickly.

I need some tracer, "strace" crashed Emacs & procmon has nice UI.

Tnx!


On Mon, Nov 2, 2020 at 8:50 AM Andrey Repin  wrote:
>
> Greetings, Oleksandr Gavenko!
>
> > I tried to find out what processes emacs-w32 is starting for my custom
> > TRAMP method.
>
> > "strace -f emacs-w32" fails.
>
> > I expected to succeed with procmon & its filter " Command/ Process Start".
>
> > Unfortunately procmon [1] doesn't report "argv" if a Cygwin executable is
> > started from a Cygwin executable. If I run a Cygwin app from the Windows
> > environment it captures positional arguments.
>
> > Is there some option to make positional arguments visible to procmon?
>
> > I could find it in:
>
> > * https://cygwin.com/cygwin-ug-net/using-cygwinenv.html
>
> Yes, it's in CYGWIN=wincmdln
> But it's not necessarily accurate.
> See the documentation for details.
>
> > * https://cygwin.com/cygwin-ug-net/setup-env.html
>
> > Please keep my email in CC...
>
> > [1] https://docs.microsoft.com/en-us/sysinternals/downloads/procmon
>
>
> --
> With best regards,
> Andrey Repin
> Monday, November 2, 2020 9:35:15
>
> Sorry for my terrible english...
>
--
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


Help with setting Cygwin's Emacs W32 TRAMP to WSL 1

2020-11-26 Thread Oleksandr Gavenko via Cygwin
I'm using Cygwin for two reasons: mintty + Emacs w32.

Nowadays WSL 1 has become important (vendors provide ready to work
.deb packages,
 I use: Ansible + Google Cloud SDK, if name any).

Still WSL 1 lacks UI and integrates less smoothly into my workflow
to replace Cygwin's amazing Emacs W32.

WSL1 files are "hidden" for regular access.

Emacs has TRAMP mode to access foreign environments:
https://www.gnu.org/software/tramp/

I tried to define configuration that should have allowed to access WSL 1
from Cygwin's Emacs via "wsl sh" jump (the way TRAMP support "su" &
"sudo" jumps):

* 
https://www.reddit.com/r/emacs/comments/jrkgmy/tramp_for_wsl_1_from_cygwin_emacsw32/
* https://github.com/microsoft/WSL/issues/6236
  - wsl.exe periodically sends control characters making impossible "piping"
  via interactive/terminal mode

The problem is that when Cygwin's Emacs invokes "wsl.exe" conhost or
wsl?? thinks
it is in a PTY mode and sends different "clearing" terminal escape
sequences (see WSL issue report).

I reproduce garbage with Elisp code:

(setq xxx (make-process :name "xxx" :buffer "xxx" :command '("wsl"
"echo" "OK") :connection-type 'pty))
(stop-process xxx)

Note that changing the last argument "pty" => "pipe" solves the problem,
but things are a bit complicated...

TRAMP mode has been implemented via call to "sh" by internal API "make-process".
And then TRAMP sends  "wsl ..." to the shell so WSL thinks it is in
PTY and I have no way
to influence that decision ((

I tried stupid tricks like passing everything related to "ws.exe" via
pipe to "cat":

  (with-eval-after-load 'tramp
(setf (alist-get "wsl" tramp-methods nil nil #'equal)
  '((tramp-login-program "sh")
(tramp-login-args (("-c") ("wsl") ("-u" "%u") ("-d" "%h")
("|" "cat")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))
(tramp-connection-timeout 10)
(tramp-session-timeout 300

or define a  wrapper script that has "wsl ... | cat"  inside. Nothing helped.
Few experiments with Cygwin's Expect also failed as I forgot
everything about that obscure tech...

So I need to write some wrapper that will bidirectionally pipe to "wsl.exe"
putting wsl into piped instead TTY mode.

It can be that there is a ready solution.

If not please advise which API should I use to write such  a wrapper.

Should it be Cygwin's pipe/dup2/fork/execvp or popen?

Or should it be Windows native CreateChildProcess / WriteToPipe /
ReadFromPipe as here:
https://docs.microsoft.com/en-us/windows/win32/procthread/creating-a-child-process-with-redirected-input-and-output

Please CC me in replies, I'll check the mail archive after a week to
not lose any responses.
--
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: Help with setting Cygwin's Emacs W32 TRAMP to WSL 1

2020-11-26 Thread Oleksandr Gavenko via Cygwin
On Thu, Nov 26, 2020 at 8:42 PM Henry S. Thompson  wrote:
>
> Oleksandr Gavenko via Cygwin writes:
>
> > ...
> > WSL1 files are "hidden" for regular access.
>
> I probably misunderstand, but I can see my WSL/Ubuntu files via this
> path from Cygwin:
>
>  /c/Users/ht/AppData/Local/Packages/CanonicalGroupLimited.../LocalState/rootfs
>
You are not allowed to edit them from the "Windows" process. Only from LXSS:

https://devblogs.microsoft.com/commandline/do-not-change-linux-files-using-windows-apps-and-tools/

> DO NOT, under ANY circumstances, access, create, and/or modify Linux files 
> inside
> of your `%LOCALAPPDATA%` folder using Windows apps, tools, scripts, consoles, 
> etc.

You'll face:

https://github.com/microsoft/WSL/issues/1524
changes made in Windows File System - not seen in Bash

Though I forgot about their announce of P9 fileserver (dated May 2019
Windows 10 version 1903):

> WSL hosts a new 9P fileserver, which exposes distro filesystems to Windows 
> apps and tools via \\wsl$\\!

Details are here:

https://devblogs.microsoft.com/commandline/whats-new-for-wsl-in-windows-10-version-1903/

I tried in elevated cmd:

cmd# cd \\wsl$\debian\
'\\wsl$\debian\'
CMD does not support UNC paths as current directories.

cmd# net use x: \\wsl$\debian\
System error 67 has occurred.
The network name cannot be found.

It is only available in Explorer and some "cool" editors, like Code.

I do not know if Cygwin allows to "mount" that P9 fileserver...

There is an example of network mounting:
https://cygwin.com/cygwin-ug-net/mount.html

so I tried it:

bash# mount '//wsl$/debian' /mnt
mount: defaulting to 'notexec' mount option for speed since native path
   references a remote share.  Use '-f' option to override.

bash# ls /mnt
ls: cannot access '/mnt/initrd.img': Input/output error
ls: cannot access '/mnt/initrd.img.old': Input/output error
ls: cannot access '/mnt/vmlinuz': Input/output error
ls: cannot access '/mnt/vmlinuz.old': Input/output error
bin  boot  c  d  dev  etc  home  init  initrd.img  initrd.img.old  lib
 lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr
var  vmlinuz  vmlinuz.old

Cool! Let's make it permanent.

$ cat /etc/fstab

//wsl$/debian /wsl/debian  ntfs binary,noacl,posix=0 0 0
//wsl$/ubuntu /wsl/ubuntu  ntfs binary,noacl,posix=0 0 0
//wsl$/alpine /wsl/alpine  ntfs binary,noacl,posix=0 0 0

$ mkdir -p /wsl/{ubuntu,debian,alpine}
$ mount /wsl/debian
$ mount /wsl/ubuntu
$ mount /wsl/wsl

And the final step it testing with Cygwin's Emacs W32:

I can read files, but on save I've got:

Saving file /wsl/debian/opt/sa-batch-am-dbsync/run.env...
basic-save-buffer-2: Unlocking file: Invalid argument,
/wsl/debian/opt/sa-batch-am-dbsync/run.env

Trying in Cygwin's bash:

bash# cd /wsl/debian/home/user/
bash# touch test.txt
bash# ls -l test.txt
-rw-r--r-- 1 user user 0 2020-11-26 21:18 test.txt

bash# echo 123 >test.txt
bash# echo 456 >>test.txt
bash# cat test.txt
123
456

So Emacs tries to make some "smart" locking on dumb FS... Need to
waste another few hours to make Emacs work.

At least I have something!
--
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: Help with setting Cygwin's Emacs W32 TRAMP to WSL 1

2020-11-26 Thread Oleksandr Gavenko via Cygwin
On Thu, Nov 26, 2020 at 9:22 PM Oleksandr Gavenko  wrote:
> So Emacs tries to make some "smart" locking on dumb FS... Need to
> waste another few hours to make Emacs work.
>
Found the problem: Emacs fails on its "unlock-buffer" call from
emacs/src/filelock.c.

Feature described here:

https://www.gnu.org/software/emacs/manual/html_node/elisp/File-Locks.html

To prevent of special symlink creation I disabled that feature:

(setq create-lockfiles nil)

So no need to waste time on TRAMP mode if it is supported natively by Cygwin!

Thx to Henry for giving me the right spin!
--
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: Help with setting Cygwin's Emacs W32 TRAMP to WSL 1

2020-11-26 Thread Oleksandr Gavenko via Cygwin
On 2020-11-26, Eliot Moss wrote:

> Lacks UI?  You can run X windows applications in WSL if you have the Cygwin X 
> server running :-) ...
> then you get the X UI.  I can certainly run xterm and emacs that way.
>
I don't need 2 Emacs instances around. Cygwin's Emacs W32 (with native W32 GUI
widgets!) is the only my Emacs on Windows.

I run Emacs server so a visited file list is kept in a one place... It is a
part of my workflow (like quick switching to earlier visited files by fuzzy
name matching/etc).

And not to mention it is extra mental load to pass that DISPLAY=:0 or whatever
around...

I believe that X server under Windows is only to write cool blog posts, that
we are able to run "xterm" ))

Thanks god Cygwin is able to mount WSL's roots via P9 network file system.

PS. As you haven't CCed me I had to check GNUS + Gmane again. Haven't read
news for 3 years, found out that Lars Ingebrigtsen fucked up with domain
transfer.

-- 
http://defun.work/

--
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: Help with setting Cygwin's Emacs W32 TRAMP to WSL 1

2020-11-28 Thread Oleksandr Gavenko via Cygwin
On 2020-11-27, Eliot Moss wrote:

> On 11/26/2020 3:38 PM, Oleksandr Gavenko via Cygwin wrote:
>
>> I believe that X server under Windows is only to write cool blog posts, that
>> we are able to run "xterm" ))
>
> Not sure what you mean here.  I run Cygwin's X server and run xterm/bash 
> windows and Emacs that way.

On daily basis? Why not mintty and emacs-w32?

Originally (2006-2012) I used native Windows Emacs + cygwin-mount.el. There
were compatibility issues, most struggles came from Emacs dependency on
external utilities to be fully functional (like search across files). Cygwin
environment gave those utilities.

Later in 2016 I had to work with Windows again and I discovered:

https://cygwin.com/packages/summary/emacs-w32.html
  This package provides emacs binaries that use the native Windows GUI for 
display.

Hooray! Good bye "cygwin-mount.el"!

I maintain "e" command to open everything in Emacs:
http://hg.defun.work/utils/file/tip/emacs

It simplifies jump from Windows CLI to Cygwin Emacs.

And recently Gradle 5.2 fixed escape sequence handling in Mintty, making it
great again:

https://docs.gradle.org/5.2/release-notes.html
  Gradle now detects when it is running from Mintty on Windows and enables the
  rich console. Mintty is a popular terminal emulator used by projects such as
  Cygwin and Git for Windows.

> I was just indicating that (provided DISPLAY=:0.0 is set, as you pointed out) 
> WSL X apps play fine 
> with the Cygwin X server.
>
OK. No problem. I was surprised that you are using X Window from Cygwin for
xterm + Emacs when there are stronger alternatives. At least you don't need to
deal with env var DISPLAY.

For "mintty" there is an issue with TERM=mintty which is not supported on most
remote hosts. I fixed it in ~/.bashrc recently by:

case $TERM in
  mintty*) alias ssh='TERM=xterm ssh' ;;
esac

Note that I need TERM=mintty for Gradle to work properly. With TERM=xterm
Gradle sends unprocessible garbage to terminal...

>> Thanks god Cygwin is able to mount WSL's roots via P9 network file system.
>
> Not sure what P9 is :-) ..
>
Here it is:

https://devblogs.microsoft.com/commandline/whats-new-for-wsl-in-windows-10-version-1903/

>> PS. As you haven't CCed me I had to check GNUS + Gmane again. Haven't read
>> news for 3 years, found out that Lars Ingebrigtsen fucked up with domain
>> transfer.
>
> ??  When people post to Cygwin, I assume that are also subscribed and will 
> get a response from
> there, and don't need _two_ emails.  But I am sending this one both places.  
> I also have not read 
> net news in years - shouldn't be necessary if you're willing to receive 
> Cygwin notes by email.
>
I planned to read email archive week later to see responses as I didn't want to
subscribe to any mail list.

So:

* I will know about responses a week later.

* I wouldn't reply to any respond as I have to retrieve/inject Message-Id to
  maintain message chain. For this I used MarkMail WEB form or some other
  offer in the past but experience was confusing.

As I understand it is not possible to specify me as additional recipient via
headers To/Cc/Bcc/Replay-To if you are in a land of email lists.

I remember some articles recommended to ask about inclusion of my email in
addition to list address - the only solution we have ((

Now that I found Gmane bridge working again (I had to alter Gmane connection
endpoint to "news.gmane.io") at least I can reply without issues when not
subscribed to the list!

-- 
http://defun.work/

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


Setting env var CYGWIN for Cygwin service?

2020-12-30 Thread Oleksandr Gavenko via Cygwin
Hi!

What way can I pass env var "CYGWIN" to the Cygwin service?

There are no that many influential options here:

  https://cygwin.com/cygwin-ug-net/using-cygwinenv.html

I can think of "winsymlinks:native" or "wincmdln".

Process Explorer shows following env vars for Cygwin's Exim process:

  PATH
  SYSTEMDRIVE
  SYSTEMROOT
  WINDIR

I configured it with "exim-config" and it is in the list of:

  cygrunsrv -L

I'm not sure if it is served by cygserver:

  https://cygwin.com/cygwin-ug-net/using-cygserver.html

-- 
http://defun.work/

--
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: Setting env var CYGWIN for Cygwin service?

2020-12-31 Thread Oleksandr Gavenko via Cygwin
On 2020-12-31, Franz Fehringer via Cygwin wrote:

> Cygwin inherits Windows environment variables, this should be the simplest 
> take.

Normally does, no doubt.

So I made `srv.c`:

  #include 
  int main() {
  sleep(60);
  }

compiled:

  gcc -o srv.exe srv.c

registered:

  cygrunsrv -I mysrv -t manual -p $PWD/srv.exe -c $PWD -e MY=hello -d "My Srv" 
-f "Testing Cyg Service"

  $ cygrunsrv -L
  exim
  mysrv

launched:

  cygrunsrv --start mysrv

Finally checked with Process Explorer:

* corresponding `cygrunsrv` had many env vars
* my `srv.exe` had only:

>PATH
>SYSTEMDRIVE
>SYSTEMROOT
>WINDIR

Same was for exim as I wrote earlier. `cygrunsrv` has everything, `exim` only
4 env vars.

  uname -r
  3.1.7(0.340/5/3)

-- 
http://defun.work/

--
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: Setting env var CYGWIN for Cygwin service?

2020-12-31 Thread Oleksandr Gavenko via Cygwin
On 2020-12-31, Bill Stewart wrote:

> cygrunsrv --help shows this:
>
> -e, --env Optional environment strings which are added
> to the environment when service is started. You can add up to 255
> environment strings using the `--env' option.

I made experiment few minutes ago (was curious to pass as many options as
possible):

  cygrunsrv -I mysrv -t manual -p $PWD/srv.exe -c $PWD -e MY=hello -d "My Srv" 
-f "Testing Cyg Service"

and didn't see "MY" in the list of env vars of actual running processes...

> These are added as REG_SZ values in
> HKLM\SYSTEM\CurrentControlSet\Services\\Parameters\Environment
> registry subkey.

Right:

  ls 
/proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/mysrv/Parameters/Environment
  MY

  cat
  
/proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/mysrv/Parameters/Environment/MY
 | strings
  hello

There is:

https://web.archive.org/web/20100306183453/http://support.microsoft.com/kb/821761
  Changes that you make to environment variables do not affect services that
  run under the Local System account until you restart Windows.

but I'm not sure that has effect:

  This behavior occurs because services that run under the Local System
  account inherit their environment from the Services.exe process. The
  Services.exe process receives the environment settings for the Local System
  account when Windows starts.

because SYSTEM/CurrentControlSet/Services is something different...

Haven't tried to reboot...

For my purpose (ensuring that env var CYGWIN is propagated into every possible
running executable) `-e` is not necessary as `cygrunsrv` inherits CYGWIN from
`SYSTEM\CurrentControlSet\Control\Session Manager\Environment`. But strangely
it is not passed to controlled process (like exim)...

-- 
http://defun.work/

--
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: Setting env var CYGWIN for Cygwin service?

2021-01-04 Thread Oleksandr Gavenko via Cygwin
On 2020-12-30, Oleksandr Gavenko via Cygwin wrote:

> What way can I pass env var "CYGWIN" to the Cygwin service?

Today I reinstalled Cygwin & Exim.

"exim-config" script asked me:

  Enter the value of CYGWIN for the daemon: []

/usr/bin/exim-config has line with:

  cygrunsrv -I exim -p /usr/bin/exim -e CYGWIN="${cygenv}" ...

So it is the answer (as pointed by others).

Still "procexp" doesn't show anything else besides PATH/WINDIR for "exim"
process. It can be that cygrunsrv passed env vars in some Cygwin *magical way*.

Cannot confirm this, attempt to read /proc/X/environ gives "". There
is no problem to read "environ" for other Cygwin processes.

-- 
http://defun.work/

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


Noticed that mintty starts non-login bash with "Win+R mintty Enter".

2021-01-04 Thread Oleksandr Gavenko via Cygwin
I interact with Cygwin via mintty launched as "Win+R mintty Enter".

During first launch of "exim-config" script existed with an error:

  /usr/bin/exim-config: line 447: USER: unbound variable

After looking into docs I got that mintty should be launched with a parameter 
"-".

Probably it was always that way.



Checking POSIX standard on what might be defined in login shell:

https://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html (1997)
https://pubs.opengroup.org/onlinepubs/009696899/basedefs/xbd_chap08.html (2004)

I noticed that USER is mentioned but LOGNAME is not only mentioned by
description is given:

  The system shall initialize this variable at the time of login to be the
  user's login name.

Cygwin's /etc/profile has:

  # Set the user id
  USER="$(/usr/bin/id -un)"

but there is nothing for LOGNAME... Shouldn't /etc/profile set LOGNAME too?

-- 
http://defun.work/

--
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 dependency: python39-markdown needs python39-importlib-metadata

2023-05-19 Thread Oleksandr Gavenko via Cygwin
I installed python39-markdown and wanted to:

  import markdown

That fails with:

  File "/home/user/my/blog_md.py", line 5, in 
import markdown
  File "/usr/lib/python3.9/site-packages/markdown/__init__.py", line 29, in 

from .core import Markdown, markdown, markdownFromFile  # noqa: E402
  File "/usr/lib/python3.9/site-packages/markdown/core.py", line 26, in 
from . import util
  File "/usr/lib/python3.9/site-packages/markdown/util.py", line 36, in 
import importlib_metadata as metadata
  ModuleNotFoundError: No module named 'importlib_metadata'

In markdown/util.py:

  if sys.version_info >= (3, 10):
  from importlib import metadata
  else:
  # http://defun.work/


-- 
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: [ANNOUNCEMENT] Updated: lighttpd-1.4.70

2023-05-19 Thread Oleksandr Gavenko via Cygwin
On 2023-05-10, Glenn Strauss via Cygwin wrote:

> lighttpd 1.4.70:
>   speed up CGI spawning; native Windows build (experimental); bugfixes

What does "native Windows build"?

Seems lighttpd is still Cygwin app:

  $ ldd /usr/sbin/lighttpd.exe
cygwin1.dll => /usr/bin/cygwin1.dll (0x7ffef6f9)

  $ lighttpd -V
  lighttpd/1.4.70 (ssl) - a light and fast webserver
  Event Handlers:
+ poll (Unix)

-- 
http://defun.work/


-- 
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: Noticed that mintty starts non-login bash with "Win+R mintty Enter".

2021-01-16 Thread Oleksandr Gavenko via Cygwin
On 2021-01-07, Kamran via Cygwin wrote:

> Even: Win | mintty - 
>
> opens up mintty with admin account.

Cool, I use  a lot but didn't know you can pass args!

-- 
http://defun.work/

--
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: Noticed that mintty starts non-login bash with "Win+R mintty Enter".

2021-01-16 Thread Oleksandr Gavenko via Cygwin
On 2021-01-05, Jason Pyeron wrote:

> I do not put Cygwin in my windows PATH, (anymore since about 10 years ago).

Sometimes it is useful to have GNU utils at hands. I use Far Commander and in
order to find directory size I type:

  du -s -m NAME

Also having Cygwin staff in PATH allows to start program elevated easily
( NAME ).

> I use an environment where settings are lost at logoff, so I have become
> accustomed to launching it from the command prompt.
>
> I have not found it too difficult to type
>
>   c:\cygwin64\bin\mintty /bin/bash -l

It won't be productive for my workflow. I own dev PC, not restricted to
corporate policies and launch mintty hundred times a day (have CDPATH and
other convenience set as the environment is permanent).

Though I might get rid of Cygwin from PATH too.

For starting Emacs I wrote wrapper that run it elevated (and hides that
irritating console as I use emacs-w32) - it is a pleasure to be able to edit
Windows /etc/hosts from within Emacs ))

Same wrapper can be written for Mintty and placed to PATH.

Though I wouldn't do that because all IDEs are rely on git.exe from Cygwin...

It is pity that Mercurial comes with "shell" launcher, so cannot be used by
non-Cygwin programs.

-- 
http://defun.work/

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


pylint: ImportError: No module named pkg_resources

2021-01-16 Thread Oleksandr Gavenko via Cygwin
After installing pylint:

  setup.exe -p pylint

I expected I can use the package:

  pylint /dev/null

  Traceback (most recent call last):
File "/usr/bin/pylint", line 5, in 
  from pkg_resources import load_entry_point
  ImportError: No module named pkg_resources

I tried to add package:

  python-setuptools

as suggested by:

  https://stackoverflow.com/questions/7446187/no-module-named-pkg-resources

and now it works.

I believe that x86_64/setup.bz2 is broken:

  depends2: python, python-logilab-astng, python-logilab-common

It doesn't mention python-setuptools.

Or it might be that /usr/bin/pylint should be rewritten to avoid dependency to
setuptools.

-- 
http://defun.work/

--
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: pylint: ImportError: No module named pkg_resources

2021-01-17 Thread Oleksandr Gavenko via Cygwin
On 2021-01-17, Marco Atzeri via Cygwin wrote:

> This explain the status problem:
>
>  $ grep -e "pylint" -e "logilab" cygwin-pkg-maint
> pylint   ORPHANED (Jari Aalto)
> python-logilab-astng ORPHANED (Jari Aalto)
> python-logilab-commonORPHANED (Jari Aalto)

Oh, I see. BTW I noticed in the mentioned link:

>https://stackoverflow.com/questions/7446187/no-module-named-pkg-resources

report on the problem as of Mar 21 '13 (with 5 upvotes for the solution).

So the problem is not recent.



Only pylint is available in Cygwin. May be I haven't tried hard but I see no
anything corresponding to Debian's:

  pycodestyle (or pep8)
  python3-pyflakes
  python3-mccabe
  python3-pydocstyle
  bandit

Still pylint was useful (I spotted shadowing built-in function "id" by global
variable).

I'll try to figure out how can I get them in venv, it is not that crucial to
have them bundled in Cygwin.

-- 
http://defun.work/

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


Python packaging policy?

2021-01-19 Thread Oleksandr Gavenko via Cygwin
I figured it out myself that I have to avoid "python3-*" packages and instead
to work with "python36-*" or "python38-*" as "python3-*" packages are marked
as "category: _obsolete" in setup.bz2.

Are there any docs that describes policy for python packages in Cygwin?

I had experience with 
https://www.debian.org/doc/packaging-manuals/python-policy/
That document had answers to the most questions.

I tried to search for similar information under:

/usr/share/doc/
/usr/share/doc/Cygwin

and in

git://cygwin.com/git/cygwin-htdocs.git

and haven't succeeded.

I'm interested in a package naming/versioning schema, a migration path across
Python releases and the way of "pip install" to live in harmony with Cygwin.

I don't insist on anything particular but some "official" generic guide how to
cook Python in Cygwin would be helpful.

-- 
http://defun.work/

--
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: Access WSL files from cygwin

2021-03-04 Thread Oleksandr Gavenko via Cygwin
On 2021-02-07, Cary Lewis via Cygwin wrote:

> Is there a way to access files from a WSL 2 Linux distro from Cygwin?
>
> From Windows:
>
> \\wsl$\Ubuntu is accessible from Windows Explorer, but cygwin does not seem
> to recogonize:
>
> //wsl\$

I use following fstab to get access to WSL 1:

//wsl$/debian /wsl/debian  ntfs binary,posix=0,user,noacl,notexec 0 0
//wsl$/ubuntu /wsl/ubuntu  ntfs binary,posix=0,user,noacl,notexec 0 0
//wsl$/alpine /wsl/alpine  ntfs binary,posix=0,user,noacl,notexec 0 0

There are problems to access some files (their attributes) but they are
special like /dev...

I have never tried WSL 2. I believe it uses P9 network fs.

Probably you have to use full distro names as reported by:

  wslconfig.exe /list

not just '//wsl$'.

See following:

https://devblogs.microsoft.com/commandline/whats-new-for-wsl-in-windows-10-version-1903/
  Announce of P9 server for WSL compatible with UNC.

Cygwin works with UNC according to the doc, that's why I tried it with fstab.

-- 
http://defun.work/

--
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 now on Python 3? What about Mercurial?

2021-04-02 Thread Oleksandr Gavenko via Cygwin
On 2021-03-07, Marco Atzeri via Cygwin wrote:

> Mercurial has been just updated to version 5.7
> https://cygwin.com/packages/summary/mercurial.html
>
> and it now depends on python3.8

Just updated:

  $ grep mercurial /var/log/setup.log.full

  Installing file 
cygfile:///usr/lib/python3.8/site-packages/mercurial-5.7-py3.8.egg-info

and had a problem:

  $ hg status

Traceback (most recent call last):
  File "/usr/bin/hg", line 59, in 
dispatch.run()
  File "/usr/lib/python3.8/site-packages/hgdemandimport/demandimportpy2.py", 
line 157, in __getattr__
self._load()
  File "/usr/lib/python3.8/site-packages/hgdemandimport/demandimportpy2.py", 
line 97, in _load
_origimport, head, globals, locals, None, level
  File "/usr/lib/python3.8/site-packages/hgdemandimport/demandimportpy2.py", 
line 44, in _hgextimport
return importfunc(name, globals, *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/mercurial/dispatch.py", line 21, in 

from .i18n import _
  File "/usr/lib/python3.8/site-packages/hgdemandimport/demandimportpy2.py", 
line 257, in _demandimport
_origimport, name, globals, locals, level=level
  File "/usr/lib/python3.8/site-packages/hgdemandimport/demandimportpy2.py", 
line 44, in _hgextimport
return importfunc(name, globals, *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/mercurial/i18n.py", line 15, in 

from .pycompat import getattr
  File "/usr/lib/python3.8/site-packages/hgdemandimport/demandimportpy2.py", 
line 257, in _demandimport
_origimport, name, globals, locals, level=level
  File "/usr/lib/python3.8/site-packages/hgdemandimport/demandimportpy2.py", 
line 44, in _hgextimport
return importfunc(name, globals, *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/mercurial/pycompat.py", line 38, in 

from .thirdparty.concurrent import futures
  File "/usr/lib/python3.8/site-packages/hgdemandimport/demandimportpy2.py", 
line 257, in _demandimport
_origimport, name, globals, locals, level=level
  File "/usr/lib/python3.8/site-packages/hgdemandimport/demandimportpy2.py", 
line 44, in _hgextimport
return importfunc(name, globals, *args, **kwargs)
ImportError: No module named concurrent

Fixed with:

  bash# update-alternatives --config python

  There are 3 programs which provide 'python'.

SelectionCommand
  ---
   + 1   /usr/bin/python2.7
 2   /usr/bin/python3.6
  *  3   /usr/bin/python3.8

  Enter to keep the current selection[+], or type selection number: 3

That would be avoided (or problem delayed until impacted another utility) if
/usr/bin/hg had shebang /usr/bin/python3 instead of /usr/bin/python.

Thx for stabilizing Mercurial!

-- 
http://defun.work/

--
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: [ANNOUNCEMENT] emacs 27.2-1

2021-04-02 Thread Oleksandr Gavenko via Cygwin
On 2021-03-27, Ken Brown via Cygwin-announce via Cygwin wrote:

> 7. The script /usr/bin/make-emacs-shortcut can be used to create a
>shortcut for starting emacs.  See
>/usr/share/doc/emacs/README.Cygwin for details.

/usr/bin/make-emacs-shortcut has:

  mkshortcut --desc="Emacs" \
--icon="/usr/bin/emacs.ico" \
--arguments="--display 127.0.0.1:0.0 ${XMLFILE}" \
--name="emacs" \
/usr/bin/run2.exe

What is /usr/bin/run2.exe? I don't have it on my system.

PS I'm using:

  cygstart --action=runas run emacs-w32

with Windows developer mode on to avoid console window ("run" utility) and
elevated ("cygstart --action=runas") to be able to edit
$WINDIR/system32/etc/hosts from Emacs (otherwise I have to launch elevated
Notepad xD).

-- 
http://defun.work/

--
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: [ANNOUNCEMENT] cygwin 3.2.0-1

2021-04-02 Thread Oleksandr Gavenko via Cygwin
On 2021-03-29, Corinna Vinschen via Cygwin-announce via Cygwin wrote:

> - Allow to start Windows Store executables via their "app execution
>   aliases".  Handle these aliases (which are special reparse points)
>   as symlinks to the actual executables.

User voice: cool!

  # ls -l /cygdrive/c/Users/$USERNAME/AppData/Local/Microsoft/WindowsApps/ | 
grep '[-]>'
  lrwxrwxrwx 1 user user  99 2020-11-26 13:24 Alpine.exe -> /cygdrive/c/Program 
Files/WindowsApps/36828agowa338.AlpineWSL_1.5.0.0_x64__my43bytk1c4nr/Alpine.exe
  lrwxrwxrwx 1 user user 107 2021-02-12 20:52 debian.exe -> /cygdrive/c/Program 
Files/WindowsApps/TheDebianProject.DebianGNULinux_1.3.0.0_x64__76v4gfsz19hv4/debian.exe
  lrwxrwxrwx 1 user user 121 2021-02-25 14:59 ubuntu.exe -> /cygdrive/c/Program 
Files/WindowsApps/CanonicalGroupLimited.UbuntuonWindows_2004.2021.222.0_x64__79rhkp1fndgsc/ubuntu.exe

WindowsApps is already in PATH (not sure who added) and allows to start WSL
distros from Cygwin!

Before I started debian/alpine via "Win + R" and conhost was used which
doesn't support Shift+Insert (although they added Ctrl+Shift+V to paste).

I use Shift+Ins a lot in Mintty. And Shift+PgUp/PgDown which is absent in
conhost.

> - Revamped pseudo console support.  Conditionally activating it only when
>  a non-cygwin application is run.

I reread latest mails to see if anyone reported about mintty CPU usage.

I read about a new version and updated and problems seems disappeared but I'm
not sure about who is responsible:

/var/log/setup.log:

  2021/04/02 15:56:321 install cygwin   3.2.0-1
  2021/04/02 15:56:322   erase cygwin   3.1.7-1

  2021/04/02 15:56:32   15 install mintty   3.4.7-1
  2021/04/02 15:56:32   16   erase mintty   3.4.6-1

Basically all mintty processes took about 1-1.5% cpu load. 5 minnty caused
7-10% CPU load (and electrical bills + fan noise) even when terminals were
idling.

Now each idling mintty takes 0.06-.11% CPU load (reported by procexp).

I took stack reports from procexp before updates. There are 2 threads caused
CPU load (first took 0.7% CPU, second 0.5% CPU on average) and the picture
reproduced 100%:

  ntoskrnl.exe!KeSynchronizeExecution+0x5b66
  ntoskrnl.exe!KeWaitForMutexObject+0x1460
  ntoskrnl.exe!KeWaitForMutexObject+0x98f
  ntoskrnl.exe!KeWaitForMutexObject+0x233
  ntoskrnl.exe!ExWaitForRundownProtectionRelease+0x7dd
  ntoskrnl.exe!KeWaitForMutexObject+0x3a29
  ntoskrnl.exe!KeWaitForMutexObject+0x1787
  ntoskrnl.exe!KeWaitForMutexObject+0x98f
  ntoskrnl.exe!KeDelayExecutionThread+0x122
  ntoskrnl.exe!SeReleaseSubjectContext+0x21bf
  ntoskrnl.exe!setjmpex+0x7c15
  ntdll.dll!NtDelayExecution+0x14
  KERNELBASE.dll!SleepEx+0x9e
  cygwin1.dll!feinitialise+0x5b43a
  cygwin1.dll!setprogname+0x3041
  cygwin1.dll!setprogname+0x3656
  cygwin1.dll!setprogname+0x4126
  cygwin1.dll!setprogname+0x41d4
  KERNEL32.dll!BaseThreadInitThunk+0x14
  ntdll.dll!RtlUserThreadStart+0x21

  ntoskrnl.exe!KeSynchronizeExecution+0x5b66
  ntoskrnl.exe!KeWaitForMutexObject+0x1460
  ntoskrnl.exe!KeWaitForMutexObject+0x98f
  ntoskrnl.exe!KeWaitForMutexObject+0x233
  ntoskrnl.exe!ExWaitForRundownProtectionRelease+0x7dd
  ntoskrnl.exe!KeWaitForMutexObject+0x3a29
  ntoskrnl.exe!KeWaitForMutexObject+0x1787
  ntoskrnl.exe!KeWaitForMutexObject+0x98f
  ntoskrnl.exe!KeWaitForMultipleObjects+0x2be
  ntoskrnl.exe!ObWaitForMultipleObjects+0x2f0
  ntoskrnl.exe!FsRtlCancellableWaitForMultipleObjects+0x229
  ntoskrnl.exe!setjmpex+0x7c15
  ntdll.dll!NtWaitForMultipleObjects+0x14
  KERNELBASE.dll!WaitForMultipleObjectsEx+0xf0
  KERNELBASE.dll!WaitForMultipleObjects+0xe
  cygwin1.dll!setprogname+0x445c
  cygwin1.dll!acl_get_perm+0x4ee0
  cygwin1.dll!setprogname+0x3041
  cygwin1.dll!setprogname+0x3656
  cygwin1.dll!setprogname+0x4126
  cygwin1.dll!setprogname+0x41d4
  KERNEL32.dll!BaseThreadInitThunk+0x14
  ntdll.dll!RtlUserThreadStart+0x21

With new Cygwin DLL & mintty the picture was changed to a single thread
consuming 0.06-0.11% CPU:

  ntoskrnl.exe!KeSynchronizeExecution+0x5b66
  ntoskrnl.exe!KeWaitForMutexObject+0x1460
  ntoskrnl.exe!KeWaitForMutexObject+0x98f
  ntoskrnl.exe!KeWaitForMutexObject+0x233
  ntoskrnl.exe!ExWaitForRundownProtectionRelease+0x7dd
  ntoskrnl.exe!KeWaitForMutexObject+0x3a29
  ntoskrnl.exe!KeWaitForMutexObject+0x1787
  ntoskrnl.exe!KeWaitForMutexObject+0x98f
  ntoskrnl.exe!KeWaitForMultipleObjects+0x2be
  ntoskrnl.exe!ObWaitForMultipleObjects+0x2f0
  ntoskrnl.exe!FsRtlCancellableWaitForMultipleObjects+0x229
  ntoskrnl.exe!setjmpex+0x7c15
  ntdll.dll!NtWaitForMultipleObjects+0x14
  KERNELBASE.dll!WaitForMultipleObjectsEx+0xf0
  KERNELBASE.dll!WaitForMultipleObjects+0xe
  cygwin1.dll!_assert+0x460c
  cygwin1.dll!acl_get_perm+0x52b0
  cygwin1.dll!_assert+0x31f1
  cygwin1.dll!_assert+0x3806
  cygwin1.dll!_assert+0x42d6
  cygwin1.dll!_assert+0x4384
  KERNEL32.dll!BaseThreadInitThunk+0x14
  ntdll.dll!RtlUserThreadStart+0x21

Next time I try to use real profiler for report, have to get familiar 

Re: [ANNOUNCEMENT] cygwin 3.2.0-1

2021-04-03 Thread Oleksandr Gavenko via Cygwin
On 2021-04-02, Thomas Wolff wrote:

> Note that if you do this within mintty, you will lose a subtle part of the
> terminal features by the Windows ConPTY terminal emulation enforced in this
> case.

I've just tested Midnight Commander, vim, aptitude, than the same all inside
tmux and the only problem I had was the color schema as I like white
background and apps chose black foreground which is hard to look at because I
made blue pretty dark (resulting in black on dark blue).

I set $TERM to "xterm-256color" in ~/.bashrc unconditionally (so no heuristics
are used by term related code).

> To avoid that, the wslbridge2 gateway should be used instead, which is
> implicitly involved when running mintty with option --WSL. I guess it would
> be useful to have wslbridge2 as a cygwin package in order to support this.

Once I tried to make wslbridge2 to work but so many hassle for unknown for me
gain...

It would be nice to have it integrated into Cygwin transparent to users if it
provides something important (in my case there weren't any blocking issues,
except color schema).

-- 
http://defun.work/

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