Jump to content
Froxlor Forum
  • 0

Froxlor 0.9.18.1 - cp: directory <customer home directory> does not exist


CoCo

Question

Hi there,

 

I've installed Froxlor 0.9.18.1 on a freshly installed FreeBSD 8.2-STABLE machine using PHP 5.3.5, and am getting an error message from the froxlor cronjob upon creation of new customers. The home directory in the system settings is set to /www/sites.

 

blerk# find /www/sites
/www/sites
[...]

 

Creating a customer with a login name of "fubar" results in:

 

blerk# /usr/local/bin/php /usr/local/www/froxlor/scripts/froxlor_master_cronjob.php --force
cp: directory /www/sites/fubar does not exist
Syntax OK
Syntax OK
blerk# find /www/sites
/www/sites
[...]
/www/sites/fubar
/www/sites/fubar/webalizer

 

Same without using --force. I tried multiple customers, and got said error for all of them.

 

Anyone else seeing this ?

Link to post
Share on other sites

19 answers to this question

Recommended Posts

did you use 0.9.18 before without errors? cause there were no changes in the cronjob in 0.9.18.1

 

I didn't try 0.9.18 at all, but installed a new machine from scratch using 0.9.18.1.

 

I tried again switching to paranoid logging, and enabling "Log cronjobs (one run)". This time I didn't get an error message, but permissions were set incorrectly:

 

drwxr-xr-x    3 10005            10005                 512 Mar 11 09:08 /www/sites/blalaber
-rw-r--r--    1 1001             1002                 1922 Mar 11 06:13 /www/sites/blalaber/index.html
drwxr-xr-x    2 10005            10005                 512 Mar 11 09:08 /www/sites/blalaber/webalizer

 

I then tried without "Log cronjobs", and again got the error message, but permissions were set correctly:

 

drwxr-xr-x    3 10006            10006                 512 Mar 11 09:11 /www/sites/blerklaber
drwxr-xr-x    2 10006            10006                 512 Mar 11 09:11 /www/sites/blerklaber/webalizer

 

I then added a slash to the home directory in the system settings, and this seems to solve the problem at hand, including the wrong permissions when "Log cronjobs" is enabled.

Link to post
Share on other sites

aha...sorry can't reproduce what you did there...

 

Omitting the ending slash for the home directory in the system settings page yields interesting results. At the very least, it looks like UID/GID of the copied index.html won't get set properly, if the ending slash is omitted.

 

Without ending slash:

10002            10002                 512 Mar 11 10:05 /www/sites/bubar
www              www                  1922 Mar  7 09:39 /www/sites/bubar/index.html
10002            10002                 512 Mar 11 10:05 /www/sites/bubar/webalizer

 

With ending slash:

10003            10003                 512 Mar 11 10:07 /www/sites/boobar
10003            10003                 512 Mar 11 10:07 /www/sites/boobar/webalizer
10003            10003                1922 Mar  7 09:39 /www/sites/boobar/index.html

Link to post
Share on other sites

Can you validate that this patch fixes the problem?

 

--- a/lib/functions/filedir/function.storeDefaultIndex.php
+++ b/lib/functions/filedir/function.storeDefaultIndex.php
@@ -55,6 +55,7 @@ function storeDefaultIndex($loginname = null, $destination = null, $logger = nul
		}
		else
		{
+			$destination = makeCorrectDir($destination);
			if ($logger !== null) {
				$logger->logAction(CRON_ACTION, LOG_NOTICE, 'Running: cp -a ' . $pathtophpfiles . '/templates/misc/standardcustomer/* ' . escapeshellarg($destination));
			}

Link to post
Share on other sites

okay, seems like a small issue in the copyIndex function...

 

Replacing the ending slash with a space gets me:

 

/www/sites 
/www/sites /bbaa
/www/sites /bbaa/index.html
/www/sites /bbaa/webalizer
/www/sites bbaa
/www/sites bbaa/webalizer

 

While I can't imagine a use-case for having an ending (or starting) space in the path, I'd say that the result is inconsistent, if someone actually wants to use such a path name.

 

More commonly users might accidentially edit the formfield in overwrite mode, replacing the ending slash with a space instead of simply deleting the last character.

 

May I suggest trimming the contents of pathnames where appropriate ?

 

Maybe it's also feasible to automatically add an ending slash to stored path names, if the value must not be a filename, anyway ?

 

I realize I'm probably nitpicking here, alas, having Froxlor prevent layer 8 errors like these seems to be quite desirable.

Link to post
Share on other sites

Can you validate that this patch fixes the problem?

 

[patch snipped]

 

 

Patching file lib/functions/filedir/function.storeDefaultIndex.php using Plan A...
Hunk #1 succeeded at 55.
done

 

Without ending slash on a fresh installation:

 

blerk# find /www/sites -ls
61258840        4 drwxr-xr-x    3 root             wheel                 512 Mar 11 11:15 /www/sites
61258753        4 drwxr-xr-x    3 10000            10000                 512 Mar 11 11:15 /www/sites/aabb
61258782        4 -rw-r--r--    1 www              www                  1922 Mar  7 09:39 /www/sites/aabb/index.html
61258785        4 drwxr-xr-x    2 10000            10000                 512 Mar 11 11:15 /www/sites/aabb/webalizer
blerk#

 

Doesn't seem to work for me.

Link to post
Share on other sites

While I can't imagine a use-case for having an ending (or starting) space in the path, I'd say that the result is inconsistent, if someone actually wants to use such a path name.

 

can happen but then has to be escaped with \

 

More commonly users might accidentially edit the formfield in overwrite mode, replacing the ending slash with a space instead of simply deleting the last character.

 

should be done by makeCorrectDir()

 

May I suggest trimming the contents of pathnames where appropriate ?

 

see above

 

Maybe it's also feasible to automatically add an ending slash to stored path names, if the value must not be a filename, anyway ?

 

see above

 

I realize I'm probably nitpicking here, alas, having Froxlor prevent layer 8 errors like these seems to be quite desirable.

 

see above

Link to post
Share on other sites

[...]

should be done by makeCorrectDir()

[...]

 

By "stored path names" I meant the actual contents of, for example, the documentroot_prefix value in Froxlors panel_settings table. By this, the value actually used would pop up in the formfield upon re-edit, instead of being silently fixed by makeCorrectDir().

 

But I'm probably getting ahead of myself here, turning this thread into a load of confusion by not concentrating on the original problem :)

Link to post
Share on other sites

But I'm probably getting ahead of myself here, turning this thread into a load of confusion by not concentrating on the original problem :)

 

true, the original bug is found and will be fixed

 

EDIT: can you test the attached patch? (caution, it includes the patch of the function.storeDefaultIndex.php file)

 

 

Link to post
Share on other sites

true, the original bug is found and will be fixed

 

EDIT: can you test the attached patch? (caution, it includes the patch of the function.storeDefaultIndex.php file)

 

 

 

Tried with a fresh installation, again. I'm no longer able to enter spaces in the path fields I tried, thanks for modifying this.

 

documentroot_prefix without trailing slash:

 

blerk# find /www/sites -ls
61258776        4 drwxr-xr-x    3 root             wheel                 512 Mar 11 13:14 /www/sites
61258787        4 drwxr-xr-x    3 10000            10000                 512 Mar 11 13:14 /www/sites/aabb
61258802        4 -rw-r--r--    1 www              www                  1922 Mar  7 10:39 /www/sites/aabb/index.html
61258803        4 drwxr-xr-x    2 10000            10000                 512 Mar 11 13:14 /www/sites/aabb/webalizer

 

documentroot_prefix with trailing slash (again on a fresh, patched installation):

 

blerk# find /www/sites -ls
61258804        4 drwxr-xr-x    3 root             wheel                 512 Mar 11 13:20 /www/sites
61258776        4 drwxr-xr-x    3 10000            10000                 512 Mar 11 13:20 /www/sites/aabb
61258787        4 drwxr-xr-x    2 10000            10000                 512 Mar 11 13:20 /www/sites/aabb/webalizer
61258802        4 -rw-r--r--    1 10000            10000                1922 Mar  7 10:39 /www/sites/aabb/index.html

Link to post
Share on other sites

That's weird but seems to have a different cause than the stuff which has be fixed with the last patch. I'll see what i can do there

 

Paranoid logging plus Cronjob logging, done without trailing slash, again a freshly patched installation, customer name "aabb":

 

11.03.11 12:30:38  	Information  	 (cronjob)  	Searching for tasks to do
11.03.11 12:30:38 	Information 	(cronjob) 	Task4 started - Rebuilding froxlor_bind.conf
11.03.11 12:30:38 	Information 	(cronjob) 	froxlor_bind.conf written
11.03.11 12:30:38 	Information 	(cronjob) 	Bind9 reloaded
11.03.11 12:30:38 	Information 	(cronjob) 	Creating new FTP-home
11.03.11 12:30:38 	Information 	(cronjob) 	Task2 started - create new home
11.03.11 12:30:38 	Notice 	(cronjob) 	Running: mkdir -p '/www/sitesaabb/webalizer'
11.03.11 12:30:38 	Notice 	(cronjob) 	Running: mkdir -p '/var/customers/mail/aabb'
11.03.11 12:30:38 	Notice 	(cronjob) 	Running: cp -a /usr/local/www/froxlor/templates/misc/standardcustomer/* '/www/sites/aabb/'
11.03.11 12:30:38 	Notice 	(cronjob) 	Running: chown -R 10000:10000 '/www/sitesaabb'
11.03.11 12:30:38 	Notice 	(cronjob) 	Running: chown -R 2000:2000 '/var/customers/mail/aabb'
[...]

 

 

Same with trailing slash:

 

11.03.11 12:37:07  	Information  	 (cronjob)  	Searching for tasks to do
11.03.11 12:37:07 	Information 	(cronjob) 	Task2 started - create new home
11.03.11 12:37:07 	Notice 	(cronjob) 	Running: mkdir -p '/www/sites/aabb/webalizer'
11.03.11 12:37:07 	Notice 	(cronjob) 	Running: mkdir -p '/var/customers/mail/aabb'
11.03.11 12:37:07 	Notice 	(cronjob) 	Running: cp -a /usr/local/www/froxlor/templates/misc/standardcustomer/* '/www/sites/aabb/'
11.03.11 12:37:07 	Notice 	(cronjob) 	Running: chown -R 10000:10000 '/www/sites/aabb'
11.03.11 12:37:07 	Notice 	(cronjob) 	Running: chown -R 2000:2000 '/var/customers/mail/aabb'

Link to post
Share on other sites

Okay, and a new patch to try :) Hope this time i got the source of the problem :)

 

 

 

Applied both patches to a fresh install, and things seem to work out now as expected with and without trailing slashes.

 

Thanks for taking care :)

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...