public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@Shaw.ca>
To: cygwin@cygwin.com
Subject: Re: BUG: Log on Scheduled Task invisible/empty window blocks input
Date: Fri, 27 Jan 2023 12:39:15 -0700	[thread overview]
Message-ID: <3bafc985-e382-5b31-bca5-3556ca6e4e40@Shaw.ca> (raw)
In-Reply-To: <CAGJ7yHC1UxsYeV9dM03+CJiHYyj85opu8yt7tzCzQ9qE8OL4GA@mail.gmail.com>

On 2023-01-26 19:43, Ross Patterson via Cygwin wrote:
> TL;DR: I needed to run a Cygwin process at user log on with highest
> privileges to perform some operations that are not allowed any other
> way without requiring a UAC prompt.  This results in a window without
> any border, close button or any other decoration that is most often
> invisible/transparent, sometimes opaque white, and most rarely with
> black unusable left/bottom scroll bars.  The window is always on top,
> accepts no inputs at all, and blocks input to windows below.  The only
> way to get rid of the windows is to kill the scheduled task process or
> trigger a UAC prompt.  More details below.
> 
> It seems like this probably is a bug, so feel free to consider this a
> bug report, but I'm mostly writing this up so others can find it and
> my workarounds and hopefully save them some hassle and I probably
> won't be doing much followup.  Both the edge cases and observed
> results are numerous and each test iteration is time consuming, but
> I've done my best to get as complete coverage as I could and to
> tightly control conditions for reliable results.
> 
> There are a few things I want to do through Cygwin that require
> privileges that cannot be attained through a service or a scheduled
> task with an "At startup" trigger.  The only way I've found to run the
> process with the required privileges without a UAC prompt and without
> disabling UAC completely is a scheduled task with these settings:
> 
> 1. "General" tab: "Run only when user is logged on" = SELECTED
> 2. "General" tab: "Run with highest priveleges" = CHECKED
> 3. "Triggers" tab: Add an "At log on" trigger for a "Specific user"
> 
> As such I've not tested this behavior with different settings on the
> "General" tab.

I use scheduled tasks with actions running scripts from /usr/local/bin/ under 
dash (or bash if required) native path with WD /var/log/ native path e.g.

%CYGWIN_ROOT%\bin\dash /usr/local/bin/....sh WD %CYGWIN_ROOT%\var\log

with various options (mainly user SYSTEM, logged in or not, highest privileges), 
and triggers.

I never see any windows appearing as the scripts log everything under /var/log/.

The scripts run as tasks start and stop Cygwin services, init and run smart 
reporting, clean up cron job remnants before smart reporting, terminate all 
processes before running setup.

For normal scripts and schedules, I use cron job commands or scripts which log 
everything under /var/log/.

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

La perfection est atteinte			Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter	not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer	but when there is no more to cut
			-- Antoine de Saint-Exupéry

  reply	other threads:[~2023-01-27 19:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27  2:43 Ross Patterson
2023-01-27 19:39 ` Brian Inglis [this message]
2023-01-29 22:55   ` Ross Patterson
2023-01-29 23:48     ` Brian Inglis
2023-01-30 11:02       ` Ross Patterson
2023-11-25 15:16 Jason Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3bafc985-e382-5b31-bca5-3556ca6e4e40@Shaw.ca \
    --to=brian.inglis@shaw.ca \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).