Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 173365 - net-ftp/pure-ftpd-1.0.21-r1 - init script fails w/ --uploadscript set
Summary: net-ftp/pure-ftpd-1.0.21-r1 - init script fails w/ --uploadscript set
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Luca Longinotti (RETIRED)
Depends on:
Reported: 2007-04-04 16:15 UTC by Christian Becke
Modified: 2008-04-18 10:47 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---

pure-ftpd --debug start *with* --uploadscript (pure-ftpd-start-with-uploadscript.log,54.33 KB, text/plain)
2007-04-04 16:18 UTC, Christian Becke
pure-ftpd --debug start *without* --uploadscript (pure-ftpd-start-without-uploadscript.log,47.21 KB, text/plain)
2007-04-04 16:19 UTC, Christian Becke
patch against pure-ftpd.rc6 (pure-ftpd.rc6.patch,980 bytes, patch)
2007-04-04 16:19 UTC, Christian Becke
Details | Diff
init script patch (pure-ftpd-init.diff,1.08 KB, patch)
2007-05-07 15:13 UTC, Mike Saywell
Details | Diff
pure-ftpd (pure-ftpd,1.43 KB, text/plain)
2007-05-13 15:18 UTC, Heiko Baums
Another patch for pure-ftpd init script (pure-ftpd.patch,886 bytes, patch)
2007-07-05 15:00 UTC, Andrian Nord
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Becke 2007-04-04 16:15:59 UTC

net-ftp/pure-ftpd fails to start with the current init script and the --uploadscript option set, possibly due to start-stop-daemon and pure-ftpd both writing to the same pid file (/var/run/ Because of this, the pid as logged in the file and as reported by "pidof" differ, leading to the function "is_daemon_running" (from /lib/rcscripts/sh/ returning "false" (see the output of "/etc/init.d/pure-ftpd --debug start" with and without --uploadscript set).
Whithout using start-stop-daemon in the start function, the init script works as expected.
This is with sys-apps/baselayout-1.12.9 and net-ftp/pure-ftpd-1.0.21-r1.


Comment 1 Christian Becke 2007-04-04 16:18:30 UTC
Created attachment 115453 [details]
pure-ftpd --debug start *with* --uploadscript
Comment 2 Christian Becke 2007-04-04 16:19:01 UTC
Created attachment 115454 [details]
pure-ftpd --debug start *without* --uploadscript
Comment 3 Christian Becke 2007-04-04 16:19:56 UTC
Created attachment 115455 [details, diff]
patch against pure-ftpd.rc6
Comment 4 Mike Saywell 2007-05-07 15:13:30 UTC
Created attachment 118456 [details, diff]
init script patch

The original init script uses start-stop-daemon to create the pid file, but when using --uploadscript it seems to get the pid wrong which causes the init script to fail.

pure-ftpd creates its own pid files anyway so the fix is simply to use these original (and correct) pid files.
Comment 5 Heiko Baums 2007-05-13 15:16:57 UTC
I'm having the same problem. The problem is that the actual init script first starts pure-ftpd and then pure-uploadscript.

When starting pure-ftpd with the option -o it seems to look for a running pure-uploadscript. If pure-uploadscript isn't running pure-ftpd fails to start.

The fix is pretty easy. Just test for '-n "$UPLOADSCRIPT"' and start pure-uploadscript before pure-ftpd. ;-)

I'll attach a working init script.
Comment 6 Heiko Baums 2007-05-13 15:18:37 UTC
Created attachment 119119 [details]

A working init script. Just moved the pure-uploadscript section above the pure-ftpd section.
Comment 7 Heiko Baums 2007-05-13 23:30:11 UTC
Well, after reading the documentation again because of another problem I'm having it seems that pure-ftpd has to be started before pure-uploadscript. I have to admit that my uploadscript doesn't work with my init script but I think/thought that this is due to some file permissions on my filesystem. But with my init script both daemons are started without an error message. So I'm not quite sure.
Comment 8 Andrian Nord 2007-07-05 15:00:09 UTC
Created attachment 123963 [details, diff]
Another patch for pure-ftpd init script

If you start default init script  with uploadscript enabled it will wait for something and then gives error "Could not launch Pure-FTPd". But if you check the process pure-ftpd (ps ax | grep pure) you see that it is start, but abnormal - not like in documentation (not pure-ftpd [IDLE/SERVER/DOWNLOAD etc]). And netstat -l says that nothing listening ftp port. But if you launch then pure-uploadscript by hand... pure-ftpd will became alive. So the problem is in way pure-ftpd making communication with pure-uploadscript (very strange way... Why not just call this script every time when upload finished?). It looks like pure-ftp not actually starts before pure-uploadscript will start.

So, if make echo $result after calling first start-stop-daemon it returns 1 - (start-stop-daemon --help says that 1 - nothing done). I.e. start-stop-daemon for some reason identifies "frosen" pure-ftpd starter-process as dead and reports that nothing was done. But start-stop-daemon has option --oknodo, witch overrides this, and program will return 0. So this is most correct and simple workaround.

Sorry for bad english. I can repeat this in Russian if it will help =).
Comment 9 Gustavo Michels 2007-09-01 13:00:41 UTC
The patch on comment #8 correctly address this issue for me.
Comment 10 Luca Longinotti (RETIRED) gentoo-dev 2008-04-18 10:47:50 UTC
Fixed in pure-ftpd-1.0.21-r1 using the patch from comment #8 (emerge --sync in a few hours to get the updated ebuild), thanks for your contribution!
Best regards, CHTEKK.