bug with cygserver-config not working anymore
Jon Turney
jon.turney@dronecode.org.uk
Thu May 22 19:00:26 GMT 2025
On 02/05/2025 12:16, Takashi Yano via Cygwin wrote:
> On Wed, 30 Apr 2025 21:30:16 +0000
> Christian Lupien wrote:
>> On a recent system install, I tried to install cygserver by executing
>> cygserver-config
>> but it failed saying that cygserver was already running.
>>
>> I have done that same install for many years with success.
>>
>> I tracked down the problem to the service discovery line inside the
>> script (line 92) that uses:
>> ps -ef | grep -v grep | grep -q ${service_name}
>> but since ps -f was changed in commit (2024-01-31)
>> 1ce9756ee61e8dff5e3319851e14ebf310a0bdd8 to return the cmdline which it
>> did not before, this fails because the script finds itself (cygserver-
>> config is found by grep -q ${service_name})
>>
>> I think the solution would be to remove the -f option to ps. So a patch
>> would be like:
>> --- cygserver-config.orig 2025-04-30 17:23:24.461779400 -0400
>> +++ cygserver-config 2025-04-30 17:23:47.067576200 -0400
>> @@ -89,7 +89,7 @@
>> _nt=`expr "${_sys}" : "CYGWIN_NT"`
>>
>> # Check for running cygserver processes first.
>> -if ps -ef | grep -v grep | grep -q ${service_name}
>> +if ps -e | grep -v grep | grep -q ${service_name}
>> then
>> echo
>> echo "There is a cygserver (${service_name}) already running. Nothing to do, apparently."
>
> Thanks for the report and patch snippet. I'll push the fix.
Ah! That's why that's suddenly started happening.
Thanks very much for tracking this down and providing the patch!
I think that Brian is also perhaps correct that the output of 'cygrunsrv
-Q' is probably what we really should be looking at.
(Examining cygserver-config, I doubt that it's ever worked correctly
when a non-default service name is provided using the -N option, since
we're grepping for a process with that name, which will never exist!)
More information about the Cygwin
mailing list