When a conf file is passed on the commandline (with '-s'), different rules are used to name the pidfile. One expects <program name>-<short conf name>.pid, however <short conf name> is missing its first letter. Example: smbd -s /path/to/file/my.conf Expected pidfile: smbd-my.conf.pid Actual pidfile: smbd-y.conf.pid The mistake is that 2 separate parts of the code are incrementing past the final '/' in the full name, in effect moving forward 2 characters. The exact same thing occurs when the conf file is in the current working directory. This is in pidfile_create() {source/lib/pidfile.c}.
Created attachment 2822 [details] Patch for 3.0.25b
Created attachment 2823 [details] Patch for 3.0.26 (with source/lib as patch base)
Hi, David! Well spotted and fixed problem, I'm going to incorporate to my hot-fixes for the FreeBSD package of 3.0.25b. But in general, in the first place I would question necessirity of the such twisted Samba behaviour, when it creates different PID file for the non-standart config file. I can see rational behind of that, when you are running several Sambas on one machine, but the implementation looks like ad-hoc hack, and adding configuration directive, that let you change pidfile name is more correct. Moreover, if you happen to have samba1/smb.conf and samba2/smb.conf files for different setups this approach wouldn't work, as it'll map to the same file name. It also creates a head ache for the distro maintainers, as scripting location of the pidfile becomes non-trivial task. Jeremy, Jerry - can you, please, review this piece of code and implement it differently? http://viewcvs.samba.org/cgi-bin/viewcvs.cgi/branches/SAMBA_3_0/source/lib/pidfile.c?rev=19533&r1=13316&r2=19533&diff_format=h That would eliminate mentioned problems. BTW, it seems, smbcontrol is still broken in the way how it handles such non-standard pidfiles, as it looks for the processes it has to talk to base on PID files. With best regards, Timur
Checked in with r24008. Thanks! Volker