← Back to team overview

freenx-team team mailing list archive

Re: Samba shares working?

 

> > I had a look into the source code (nxnode) and I think that there is a
> > timing problem. It looks like it takes some time until the SMB-Port is
> > open, but the function that does the mount is called earlier.

> You should take a look at nxnode on the function cmd_node_smbmount().
> What is the command you use to mount the share?

After some more debugging and testing I finally solved the problem. When 
cmd_node_smbmount (as well as cmd_node_addprinter) is called, the function
gets instantly terminated (at least in my setup/environment) because it was
not properly detached.

I had to add several things to the cmd_node_smbmount call:
- Use "double fork" (thanks to [1]) 
- Use trap
- Close all open file handles


Here is the diff, I think I'll post it to the freenx-list, too.


# diff -u nxnode.orig nxnode
--- nxnode.orig 2009-04-09 16:00:02.000000000 +0200
+++ nxnode      2009-04-24 10:38:14.000000000 +0200
@@ -1560,10 +1560,10 @@
                cmd_node_suspend
        ;;
        --smbmount)
-               cmd_node_smbmount &>/dev/null </dev/null &
+               ( trap '' 1; for ((i=3; i<255; i++)); do eval "exec $i<&- $i>&-"; done; cmd_node_smbmount &>/dev/null </dev/null & )
        ;;
        --addprinter)
-               cmd_node_addprinter &>/dev/null </dev/null &
+               ( trap '' 1; for ((i=3; i<255; i++)); do eval "exec $i<&- $i>&-"; done; cmd_node_addprinter &>/dev/null </dev/null & )
        ;;
        --check)
                echo "NX> 716 finished"



Thilo


[1] http://billharlan.com/pub/papers/Bourne_shell_idioms.html


-- 
Thilo Uttendorfer
Linux Information Systems AG
Putzbrunner Str. 71, 81739 München

t.uttendorfer@xxxxxxxxxxxx, http://www.linux-ag.com



References