Re: [PATCH cygutils 1/1] cygstart: add 'runas' as option to elevate privileges like UAC
Mark Geisert via Cygwin-apps <[email protected]>
| Newsgroups | gmane.os.cygwin.applications |
|---|---|
| Message-ID | <[email protected]> |
Hi Vadim,
On 8/8/2025 5:53 AM, Vadim (vadcx) via Cygwin-apps wrote:
> On 8/8/25 10:51, Mark Geisert wrote:
>
>>> + {"runas", 'r', POPT_ARG_NONE, NULL, 'r',
>>> + "Short for: --action runas", NULL},
>>
>> I understand you're adding a new action selected by arg 'r'...
>>
>>> {NULL, '\0', 0, NULL, 0, NULL, NULL}
>>> };
>>> @@ -223,7 +226,7 @@ main (int argc, const char **argv)
>>> "Display version information", NULL},
>>> {"license", '\0', POPT_ARG_NONE, NULL, 'l',
>>> "Display licensing information", NULL},
>>> - {"reference", '\0', POPT_ARG_NONE, NULL, 'r',
>>> + {"reference", '\0', POPT_ARG_NONE, NULL, 'W',
>>> "Open MSDN reference for ShellExecute", NULL},
>>
>> ... and changing existing action 'r' to 'W'. But the string
>> "reference" needs to be changed to something starting with 'W' then.
>> Did you have a word in mind when choosing 'W' as the new action?
>>
>> Alternatively, is there a word+action that better indicates what that
>> command does? Granted, it's a pretty obscure and complicated thing to
>> reduce down to one word.
>
> Correct, -r should invoke "runas". As far as I can tell after inspecting
> these opt structs, this 5th argument (last letter on the line) is only
> used to fetch the option in code. The usable short-hand argument is 2nd
> (empty here).
>
> So to avoid changing the current --reference option, I decided to rename
> the internal letter to "W" as in "Web (reference)", but keep the long-
> name. I found it would create less confusion than instead having option
> -r not correspond to internal code 'r'. The letter 'M' is taken by
> --maximize too.
>
> In the end, it's just an unfortunate letter collision (I hope my
> understanding is correct) and one has to give way or rename --reference
> entirely (to --web ?). Giving "--action=runas" a different letter than
> 'r' would make a really awful mnemonic in my opinion.
OK, I follow and agree with your reasoning. I've applied your patches
locally and built a cygutils-1.4.17-5 test release. My usual upload
workflow doesn't work anymore, likely due to the already-announced (on
the cygwin-apps list) deprecation of same. I need to work out how to
accomplish the upload using current best practices. Give me a bit of
time please.
Regards,
..mark