[ https://issues.apache.org/jira/browse/DAEMON-458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brian Andle updated DAEMON-458: ------------------------------- Description: As part of DAEMON-446 a regression was introduced that causes existing service DependsOn services to be removed when working with the //US option. Replication: Run: {code:java} prunsrv.exe //IS/MyService --Startup=auto --Description=MyService --DisplayName=MyService sc config MyService depend=Tcpip/Afd/Dhcp {code} View the services and note that *MyService* depends on Dhcp (the sc config command is being to represent a separate script call) Now run: {code:java} prunsrv.exe //US/MyService --Startup=manual {code} View the services and note that MyService no longer depends on Dhcp The offending code appears to be the following in service.c: {code:java} /* Add the mandatory dependencies */ if (lpDependencies) { lpDependencies = apxMultiSzCombine(NULL, lpDependencies, L"Tcpip\0Afd\0", NULL); } else { lpDependencies = L"Tcpip\0Afd\0"; }{code} Which means if DependsOn isn't defined we'll always pass down Tcpip and Afd, vs the NULL that happened before. Wiping existing custom dependancies out. I didn't test it but this code may not work properly with the – vs ++ logic defined under [https://commons.apache.org/proper/commons-daemon/procrun.html] The DAEMON-446 ticket talks about --DependsOn (full replace) although I only see ++Depends on documented, so maybe DAEMON-446 was actually invalid to begin with? was: As part of DAEMON-446 a regression was introduced that causes existing service DependsOn services to be removed when working with the //US option. Replication: Run: {code:java} prunsrv.exe //IS/MyService --Startup=auto --Description=MyService --DisplayName=MyService sc config MyService depend=Tcpip/Afd/Dhcp {code} View the services and note that *MyService* depends on Dhcp (the sc config command is being to represent a separate script call) Now run: {code:java} prunsrv.exe //US/MyService --Startup=manual {code} View the services and note that MyService no longer depends on Dhcp The offending code appears to be the following in service.c: {code:java} /* Add the mandatory dependencies */ if (lpDependencies) { lpDependencies = apxMultiSzCombine(NULL, lpDependencies, L"Tcpip\0Afd\0", NULL); } else { lpDependencies = L"Tcpip\0Afd\0"; }{code} Which means if DependsOn isn't defined we'll always pass down Tcpip and Afd. Wiping existing custom dependancies out. I didn't test it but this code may not work properly with the – vs ++ logic defined under [https://commons.apache.org/proper/commons-daemon/procrun.html] The DAEMON-446 ticket talks about --DependsOn (full replace) although I only see ++Depends on documented, so maybe DAEMON-446 was actually invalid to begin with? > The changes in DAEMON-446 cause existing DependsOn values to be removed > ----------------------------------------------------------------------- > > Key: DAEMON-458 > URL: https://issues.apache.org/jira/browse/DAEMON-458 > Project: Commons Daemon > Issue Type: Bug > Affects Versions: 1.3.2, 1.3.3 > Reporter: Brian Andle > Priority: Major > > As part of DAEMON-446 a regression was introduced that causes existing > service DependsOn services to be removed when working with the //US option. > > Replication: > Run: > {code:java} > prunsrv.exe //IS/MyService --Startup=auto --Description=MyService > --DisplayName=MyService > sc config MyService depend=Tcpip/Afd/Dhcp {code} > View the services and note that *MyService* depends on Dhcp (the sc config > command is being to represent a separate script call) > Now run: > {code:java} > prunsrv.exe //US/MyService --Startup=manual {code} > View the services and note that MyService no longer depends on Dhcp > The offending code appears to be the following in service.c: > {code:java} > /* Add the mandatory dependencies */ > if (lpDependencies) { > lpDependencies = apxMultiSzCombine(NULL, lpDependencies, > L"Tcpip\0Afd\0", NULL); > } else { > lpDependencies = L"Tcpip\0Afd\0"; > }{code} > Which means if DependsOn isn't defined we'll always pass down Tcpip and Afd, > vs the NULL that happened before. Wiping existing custom dependancies out. > I didn't test it but this code may not work properly with the – vs ++ logic > defined under [https://commons.apache.org/proper/commons-daemon/procrun.html] > The DAEMON-446 ticket talks about --DependsOn (full replace) although I only > see ++Depends on documented, so maybe DAEMON-446 was actually invalid to > begin with? > > -- This message was sent by Atlassian Jira (v8.20.10#820010)