File Locks between LetoDBf and other applications

2,424 views
Skip to first unread message

Ash

unread,
Jul 1, 2017, 8:08:16 AM7/1/17
to Harbour Users
Hello Rolf,

It appears that file locking between LetoDBf and other applications is not working. Please consider the following: 

//letodb.ini
[Main]
DataPath = /data/comp
LogPath = /var/log/letodb         
EnableFileFunc = 1
EnableUDF = 1 
Cache_Records = 21
;Debug = 10
HardCommit = 1
TimeOut = -1

; Own workareas for each user.
No_Save_WA = 1

; Opens tables in mode requested by client applications. This allows
; LetoDB to coexist with other applications.
Share_Tables = 1


//lshr.prg
REQUEST LETO

#include "rddleto.ch"

PROCEDURE main( )

   cAddress := "//192.168.2.200:2812/"

   IF leto_Connect( cAddress ) < 0
      ALERT( "NO LETODB SERVER FOUND - ERROR: " + leto_Connect_Err( .T. ) )
      QUIT
   ENDIF

   USE .\compk\bkstat EXCLUSIVE NEW
   IF NetErr()
      ? 'Cannot lock file.'
      inkey(0)
   ELSE
      browse()
   ENDIF

RETURN

//shrd.prg
PROCEDURE main( )

   USE z:\comp\compk\bkstat EXCLUSIVE NEW
   IF NetErr()
      ? 'Cannot lock file.'
      inkey(0)
   ELSE
      browse()
   ENDIF

RETURN

Compile and run both programs. Results are shown below.

lshr.exe
lshr.exe // unable to lock file -OK

shrd.exe
shrd.exe // unable to lock file -OK

lshr.exe
shrd.exe // not aware of file lock by lshr.exe -ERROR

shrd.exe
lshr.exe // not aware of file lock by shrd.exe -ERROR

Regards.
Ash




elch

unread,
Jul 2, 2017, 12:13:30 PM7/2/17
to Harbour Users
Hello Ash,


It appears that file locking between LetoDBf and other applications is not working.

I can *not* reproduce error, seem specific to your environment,

as my "shrd" is a Linux executable run at server and i notice a drive-letter in example: Samba ?



//letodb.ini
Share_Tables = 1

1 --> use 'real' *record* locks viewable to other applications

and also respect record locks set by other

( else the record locks are 'virtual' [ internal list with record numbers ] )


Database driver must be also the same, given by:

"Default_Driver" in 'letodb.ini' ( LetoDBf application can change its default )

LetoDB[f] server default: CDX versus Harbour default: NTX

--> shrd.prg example will use DBFNTX

( NTX locking != CDX; see harbour/docs/locks.txt )


Lastly LetoDBf can even utilize extended "Lock_Scheme" for huge database

( leave expert option out if not needed )


All above relates to *record* locking.


-----

# verify file is really the same ;-)

# use same database driver as used by server

# check for locks, maybe for SMB with:

smbstatus -L

and for LetoDBf server with lsof ?:

lsof /data/comp/compk/bkstat.dbf

( http://www.linuxask.com/questions/how-to-check-if-a-file-is-locked-in-linux )

# Samba have options about locking/ oplocks ...


best regards
Rolf

Ash

unread,
Jul 3, 2017, 8:26:45 AM7/3/17
to Harbour Users
Hello Rolf,

# verify file is really the same ;-)
Same file - Confirmed.
 
# use same database driver as used by server
DBFCDX - Confirmed.
 
# check for locks, maybe for SMB with:
smbstatus -L
When both programs are running
# smbstatus -L
Locked files:
Pid          Uid        DenyMode   Access      R/W        Oplock           SharePath   Name   Time
--------------------------------------------------------------------------------------------------
26768        0          DENY_ALL   0x12019f    RDWR       NONE             /volume1/bms   comp/compk/bkstat.dbf   Mon Jul  3 08:07:00 2017
 
and for LetoDBf server with lsof ?:
When both programs are running
# lsof /data/comp/compk/bkstat.dbf
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF  NODE NAME
letodb  11617 root  226uW  REG  253,0     1091 52809 /data/comp/compk/bkstat.dbf
smbd    26768 root   33u   REG  253,0     1091 52809 /data/comp/compk/bkstat.dbf 

# Samba have options about locking/ oplocks ...

oplocks are disabled.

Regards.
Ash

elch

unread,
Jul 3, 2017, 10:55:15 AM7/3/17
to Harbour Users
Hello Ash,

# smbstatus -L
Pid          Uid        DenyMode   Access      R/W        Oplock           SharePath   Name   Time
26768        0          DENY_ALL   0x12019f    RDWR       NONE             /volume1/bms   comp/compk/bkstat.dbf   Mon Jul  3 08:07:00 2017

DENY_ALL is what we want in example -- but its not set at server.


# lsof /data/comp/compk/bkstat.dbf
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF  NODE NAME
letodb  11617 root  226uW  REG  253,0     1091 52809 /data/comp/compk/bkstat.dbf
smbd    26768 root   33u   REG  253,0     1091 52809 /data/comp/compk/bkstat.dbf 

We see for letodb an upper 'W" ( in FD FileDescriptor ) == exclusive opened.

( would be 'R' if opened in shared mode )

But there is *none* for smbd ( Samba ) --> IMO cause of problems.


Now to configure Samba ( i do that rarely ):

[ if an option is not set, version dependent default value is active ]

oplocks = no

level2 oplocks = no

share modes = yes

locking = yes

strict locking = no

more ? ...


If no success, maybe ZIP! your smb.conf,
and a more experienced one hopefully have a quick look into ..

best regards
Rolf

Ash

unread,
Jul 3, 2017, 3:19:08 PM7/3/17
to Harbour Users
Hello Rolf,

No luck, I am afraid.  I am using Synology DS713+ (DSM 6.1) NAS where LetoDBf and Samba are installed.

Below are the contents of my smb.conf.

Regards.
Ash

[global]
printcap name=cups
winbind enum groups=yes
include=/var/tmp/nginx/smb.netbios.aliases.conf
oplocks=no
locking=yes
min protocol=NT1
security=user
local master=no
realm=*
strict locking=no
passdb backend=smbpasswd
printing=cups
max protocol=SMB2
winbind enum users=yes
level2 oplocks=no
load printers=yes
workgroup=delos

[bms]
recycle bin admin only=no
ftp disable modify=no
ftp disable download=no
write list=nobody,nobody
browseable=yes
mediaindex=no
hide unreadable=no
win share=yes
enable recycle bin=no
invalid users=nobody,nobody
read list=nobody,nobody
ftp disable list=no
edit synoacl=yes
valid users=nobody,nobody
writeable=yes
guest ok=yes
path=/volume1/bms
skip smb perm=yes
comment="Business Management System"

elch

unread,
Jul 4, 2017, 12:00:44 PM7/4/17
to Harbour Users
Hello Ash,

this 'win share = yes' in smb.conf is unknown to me,
but i fear it won't change something.

Problem should be independent of LetoDB[f] !?,

and should relate to just a DBF EXCLUSIVE opened one time over Samba,

other time local at Linux server.

So just two instances of your 'shrd.prg' with two different paths,

one time as linux app to run at server ... -- can you confirm ?


I'm curious about where the problem was, please let me know.


best regards
Rolf

Ash

unread,
Jul 4, 2017, 1:12:28 PM7/4/17
to Harbour Users
Hello Rolf,

Could it be because LetoDBf is running in chroot environment?

Regards.
Ash

elch

unread,
Jul 4, 2017, 2:19:14 PM7/4/17
to Harbour Users
Hello Ash,


Could it be because LetoDBf is running in chroot environment?

sure no 'chroot', that means IMHO something very different ...


LetoDBf open the databases just with Harbour engine [ hb_rddOpenTable() ],

beforehand 'magically' ;-) calculates the absolute path,

so my conclusion in last post was that reported problem relates to any DBF opened by Harbour directly at server


best regards

Rolf

 

elch

unread,
Jul 5, 2017, 8:43:00 AM7/5/17
to Harbour Users
Hello Ash,

can you please compile following for your Linux server (NAS)


-- snip --

//shrd2.prg

PROCEDURE main( )

LOCAL cText := TIME()


USE z:\comp\compk\bkstat EXCLUSIVE NEW

IF NetErr()

cText += " bkstat open FAIL"

ELSE

cText += " bkstat open EXCL"

ENDIF


//MEMOWRIT( "/var/log/letodb/result.txt", cText )

? cText



RETURN

-- snip --


then start firstly your Windows shrd.exe from first post

--> should go into browse.


Then start above at machine with LetoDBf:

correct would be an open fail ...


best regards

Rolf

elch

unread,
Jul 5, 2017, 11:46:02 AM7/5/17
to Harbour Users
Hello Ash,

a drag and drop error, surely to use the path at server:



can you please compile following for your Linux server (NAS)

-- snip --

//shrd2.prg

PROCEDURE main( )

LOCAL cText := TIME()


USE /data/comp/compk/bkstat.dbf EXCLUSIVE NEW

Ash

unread,
Jul 5, 2017, 1:21:32 PM7/5/17
to Harbour Users
Hello Rolf,

Here are the results.

then start firstly your Windows shrd.exe from first post
--> should go into browse.
 
At Windows Machine:
Started shrd.exe
browse showing.

Then start above at machine with LetoDBf:
correct would be an open fail ...
 
At NAS
Started shrd2
13:13:02 bkstat open EXCL

Regards.
Ash



Ash

unread,
Aug 25, 2017, 9:25:42 AM8/25/17
to Harbour Users
Hello Rolf,

Still having this issue.

Regards.
Ash

elch

unread,
Dec 14, 2017, 8:47:51 AM12/14/17
to Harbour Users
Hello!!, Ash
Still having this issue.
and it won't go away -- a pure 'Samba' related topic:

Samba: USE <EXCLUSIVE> via smbclient <versus> file-access at server
Result: the one side don't respect the other sides' <EXCLUSIVE>

The cause:
# this <EXCLUSIVE> lock is the first typus of a OS-system lock, see it as a 'whole file' lock
# FLock() and RLock() are a second typus, both! R|F-Lock() are so called 'byte-range' partial-fiel locks.

Above in mind, we check Samba doc, section Discussion:
" .. byte-range [R|F] lock .. No other locks can be seen by UNIX .. "
( https://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/locking.html )

This means further:
'whole-file' <EXCLUSIVE> locks are handled only 'internally' in Samba,
and Samba neither set nor even check for these at server.


---
# 1:
avoid logic relying on <exclusive>,
ever open <shared> in local App and in Samba App, then FLock() ...
This will not prevent from critical moments, when <exclusive> logic is needed/
implemented.


# 2: -- only theoretically --
avoid file access directly at server.
That would mean, LetoDBf or any other maybe Harbour application at server! must access their files as a Samba-client.

Such could be done by mounting a 'Share', in this case to mount the share from itself with e.g.
mount -t cifs -o username=.. //localhost/bms /mnt/mySamba
[ more options, mount-point is your choice to make, automizeable in fstab ]

I have tested such a set-up, it basically "works",
but i experienced such *drastic* performance impacts (for LetoDBf),
that i like to name this a _theoretical_ solution, at least as a general appoach.
Maybe a second LetoDBf at different port for only some specific, rarely! used DBF .... ?


# 3:
tell one us ! ...

best regards
Rolf

Ash

unread,
Dec 31, 2017, 7:52:37 PM12/31/17
to Harbour Users
Hello Rolf,

It is very good to hear from you.

#1:

avoid logic relying on <exclusive>,
ever open <shared> in local App and in Samba App, then FLock() ...
This will not prevent from critical moments, when <exclusive> logic is needed/
implemented.

This option works correctly. Mercifully there were only a couple of places in the entire system that required conversion. 

Happy new year.

Regards.
Ash



Ash

unread,
Jan 1, 2018, 6:42:11 PM1/1/18
to Harbour Users
Hello Rolf,

Further testing shows that PACK, REINDEX and ZAP commands only work with tables USEd in EXCLUSIVE mode or when SET EXCLUSIVE is ON. I'll have to find another way to get over this issue.

Regards.
Ash

elch

unread,
Jan 2, 2018, 5:15:30 PM1/2/18
to Harbour Users
VERY thanks!!, Ash

wish a finest new year to you!

----
as expected !, and i mentioned it ...

#1 (b)
choose a control file:
this to open <SHARED>, then if FLock() possible proceed with <ECLUSIVE> actions on other files.

!UGLY!,
as it wouldn't hinder any application just to ignore this 'logic' ...


---
proceed with #2:
how to 'mount' a Samba share automatically in '/etc/fstab' with OS startup,
is a Google search depending on the OS running on your NAS.

Then we start a second LetoDBf, different port, but DataPath pointing to the mount point of the 'Samba server share'.
Then you have adapt the LetoDBf apps, to ask this! LetoDBf for <exclusive> usage, e.g. for ZAP PACK ...

----
I still see no other chance, because whatever 'trick' i might add to Harbour/ LetoDBf -- it just will be ignored by Samba !!
I thought about a 'smbstatus' query, analysed with a process-run,
*but* it may be invalid next millisecond after a query -- and Samba else will ignore any trick ...

i like to make wonders, but can not do miracle :-)
elch

Antonio Lima

unread,
Jan 3, 2018, 9:35:27 AM1/3/18
to Harbour Users
File and record locking with simultaneous samba sharing with windows in 2017 A/C?

LOL !!!

https://support.microsoft.com/en-us/help/4034314/smbv1-is-not-installed-windows-10-and-windows-server-version-1709

Let's pray!

Ash

unread,
Jan 5, 2018, 4:08:05 PM1/5/18
to Harbour Users
Hello Rolf,

I'll be testing #1(b) in the next few days. Is it possible to show lock information for each table in LetoDBf Console?

i like to make wonders, but can not do miracle :-)
Not sure if I can tell the difference in this case.

Regards.
Ash

elch

unread,
Jan 9, 2018, 2:06:21 PM1/9/18
to Harbour Users
Hello Ash,
I'll be testing #1(b) in the next few days. Is it possible to show lock information for each table in LetoDBf Console?
 
sure, console show <open mode> in 3rd column in browse: Databases.
It even shows <record> locks (4th 'red' browse at bottom left ),
but not <per connection> [ disabled by intention ! ..... ]
To see <record> locks, choose connection: console!,
then you should see all locks of all connections for a database.

Console misses <file> locks,
and i have very actually no plan to add code and overhead for that.

-----
BTW, did you hear about LetoDBf server <hopping> ? :-)
Leto_ReConnect():
to dis-connect from one, then to connect to another server,
with the difference that your workarea environment should be exactly!
restored for the new connection.

This is 'problematic' if the server is on another machine,
as the databases may be not the same/ not even existing.
And there is a possible race condition even its the same:
if another user locks something right in the milliseconds during <hopping>,
we! had before locked and then want to have back ...

Oh, the context of above: #2
and if i theoretically could add 'automatics' ...
Leto_ReConnect() would be for manual use:
switch to second -- open table exclusive, perform action, close -- switch back

some new <raw> thoughts ...

best Regards
Rolf

Ash

unread,
Jan 9, 2018, 3:54:28 PM1/9/18
to Harbour Users
Hello Rolf,

I found the <record> locks. Thanks.

Consider the following:

Open an application and lock customer 899. 899 is displayed in the red box. Leave the application open.
Open the same application again and lock record 1010. 1010 is not displayed in the red box. Leave the application open.
Close the first instance of the application. 1010 is now displayed in the red box.

Regards.
Ash

elch

unread,
Jan 9, 2018, 6:52:29 PM1/9/18
to Harbour Users
yps, Ash

I found the <record> locks. Thanks.

Consider the following: ...
yes!, that is not as i wanted it to show -- and not what i've already seen/ expect/ described;
I sure! will have a look for that ...

-----
With the same 'easyness' you can mix Harbour RDDs,
you should be able to mix multiple LetoDBf server.
( therfore we need no <server hopping> ;-),
{ just wanted to mention it -- originally designed for a different cause ]

---
After a table is opend at one specific server,
this info is bound to the workarea!,
so you must not take further care about.

And when i then add to LetoDBf a new optional option:
server <address:port> to connect for <exclusive actions>
( Leto should be able to track that at RDD low-level .. )
we are nearly done, aren't we ?

For sure such takes 'a serious moment' to implement.
In the meanwhile ..
-- or very better! before i even start
-- you like to test if it works 'manually' ... ?

best regards
Rolf

elch

unread,
Jan 10, 2018, 10:39:24 AM1/10/18
to Harbour Users
Hello Ash,


I found the <record> locks. Thanks.
Consider the following:
Open an application and lock customer 899. 899 is displayed in the red box. Leave the application open.
Open the same application again and lock record 1010. 1010 is not displayed in the red box. Leave the application open.
Close the first instance of the application. 1010 is now displayed in the red box.

no bug, a feature:
the longer the console gets no <inkey>, the rare it makes screen updates.
Retrieving the shown info blocks other users from their work.
For 'a minute long' high speed watching change: ALT-Menu.ChangeRefresh

best regards
Rolf

Ash

unread,
Jan 10, 2018, 12:38:26 PM1/10/18
to Harbour Users
Hello Rolf,

I have spent a lot of time trying to get LetoDBf and Samba to work together without success. Both Samba and LetoDBf honour each other's record and file locking. However, the 'USE EXCLUSIVE' of a table in Samba is not recognized by LetoDBf and vice versa. 

As I'm at the end of my tether, I'll let my customers decide on LetoDBf or Samba, but not both. Former providing up to 10 times the speed advantage. 

Many thanks to all for their counsel.

Regards,
Ash

elch

unread,
Jan 10, 2018, 1:50:55 PM1/10/18
to Harbour Users
Hello Ash,

right time to make a bit magic ;-)

If you look once more at suggest #2,
i wrote it works, aka both sides respect their <exclusive>,
but is fully unacceptible slow for general usage.

---
New idea is to use *two* LetoDBf server at same machine,
where the second LetoDBf points to mountpoint of 'local' SMB share at server.
This address/ port of the second server can now 'burnt' fix into the client lib.

Then *only* for <exclusive> usage the second server is used,
fully automatically!
For all <shared> tables your 'default' server is used.

# you would have to do:
set address/ port in the rddleto[addon].hbp before you build the RDD.
In your application you connect first to <exclusive> LetoDBf,
then to the default one.
( in short described also in ChangeLog.txt )

---
Before you make *persistent* OS start-up changes in /etc/fstab,
( perhaps i can help );
you can test it manually!

# we need a 'mount-point' directory:
mkdir /mnt/samba

# and mount samba (fill in a username) here:
mount -t cifs -o username=.. //localhost/bms /mnt/samba

# need a second directory place for second LetoDBf,
as it else would read the others letodb.ini, adapt the port! therin.
start second LetoDbf

#try your app

---
So far its ready and just uploaded.
I you want to test, its up to you -- won't be angry if you won't.
If questions are left open ...

I can make the process surely more comfortable,
as to read the address out of an .ini instead of fixed 'burning' into,
but this way its was most less effort for me ...

best regards
Rolf

elch

unread,
Jan 11, 2018, 5:11:12 AM1/11/18
to Harbour Users
Hello Ash,

..

# need a second directory place for second LetoDBf,
as it else would read the others letodb.ini, adapt the port! 


isn't that 'ugly' !? -- uploaded an improvement;
to use e.g. "letosmb.ini" start the second server with:
letodb config letosmb

best regards
Rolf

Ash

unread,
Jan 11, 2018, 6:48:53 AM1/11/18
to Harbour Users
Hello Rolf,

Would you you be so kind to write a mini HowTo for me to implement your idea. My environment where LetoDBf is running is as shown below. 

Synology DS713+

/usr/local/bin/letodb

/etc/letodb.ini


[Main]

DataPath = /data/comp

LogPath = /var/log/letodb        

EnableFileFunc = 1

EnableUDF = 1

HardCommit = 1

TimeOut = -1

No_Save_WA = 1

Share_Tables = 1 


Regards.
Ash

elch

unread,
Jan 11, 2018, 8:55:48 AM1/11/18
to Harbour Users
Hello Ash,

outcomment [ add one ';' in front ] that line in your letodb.ini
;HardCommit = 1

I expect your Synology using a journaling filesystem,
then this is not only very! performance reducing but counter-productive.
That is NOT a DOS machine ...


---
Show (zip) me these both:
/etc/fstab
/etc/samba/smb.conf
[ a bit unsureness about place of your samba config ]


----
as user root:
# make a copy of letodb.ini
cp /etc/letodb.ini /etc/letosmb.ini

# edit /etc/letosmb.ini, change:
DataPath = /mnt/samba
# add:
Port = 2814
# definitely! remove HardCommit line





# make mount-point
mkdir /mnt/samba

-----
as normal user:
# in the one you are using : rddleto[addon].hbp, remove the comments '#' for:
-cflag="-DLETO_SMBSERVER=localhost"
-cflag="-DLETO_SMBPORT=2814"

( localhost should nice fit, we'll see ... )


now need to see smb.conf ...

Rolf

Ash

unread,
Jan 11, 2018, 9:47:00 AM1/11/18
to Harbour Users
Hello Rolf,

Here are the contents of the files you asked for.

Regards.
As

fstab

none /proc proc defaults 0 0
/dev/root / ext4 defaults 1 1
/dev/vg1000/lv /volume1 ext4 usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0,synoacl,relatime 0 0

samba.conf

[global]
printcap name=cups
winbind enum groups=yes
include=/var/tmp/nginx/smb.netbios.aliases.conf
oplocks=no
locking=yes
min protocol=SMB2
security=user
local master=no
realm=*
strict locking=no
passdb backend=smbpasswd
printing=cups
max protocol=SMB3
winbind enum users=yes
level2 oplocks=no
load printers=yes
workgroup=delos

elch

unread,
Jan 11, 2018, 3:38:21 PM1/11/18
to Harbour Users
Hello Ash,

/dev/vg1000/lv /volume1 ext4 usrjquota=...
as expected, a journaling EXT4
--> surely deactivate HardCommit in letodb.ini
 
samba.conf

[global]
printcap name=cups
winbind enum groups=yes
include=/var/tmp/nginx/smb.netbios.aliases.conf
...
That are only 'global' settings,
and i miss at least one 'share' section in samba.conf.
Perhaps they hide in the 'include' file' ?,
Searching something that starts e.g.:

[bms]
comment = exclusive fun
path = /data/comp
browseable = yes
directory mask = 0771
create mask = 0660


On such a 'share' name i was referring in last posts.
How does it appear in your Windows Explorer after connecting ?
I get there below: all networks - M$ network - workgroup [your is delos] a list of such shares ..

best regards
Rolf

Ash

unread,
Jan 12, 2018, 8:14:43 AM1/12/18
to Harbour Users
Hello Rolf,

smb.share.conf

[bms]
recycle bin admin only=no
ftp disable modify=no
ftp disable download=no
write list=nobody,nobody
browseable=yes
mediaindex=no
hide unreadable=no
win share=yes
enable recycle bin=no
invalid users=nobody,nobody
read list=nobody,nobody
ftp disable list=no
edit synoacl=yes
valid users=nobody,nobody
writeable=yes
guest ok=yes
path=/volume1/bms
skip smb perm=yes
comment="Business Management System"

Share appears in explorer as bms.

Regards.
Ash

elch

unread,
Jan 12, 2018, 11:29:10 AM1/12/18
to Harbour Users
Hello Ash,

a) minutes ago:
refresh source, but beware rddleto[addon] hbp,
( we adapted 2 defines )
: rebuild all + console

we continue from yesterday

-----
# as root (sudo):
mount -t cifs -o guest //localhost/bms /mnt/samba

should silent do its work -- <bms> share seem to need no user name ...
As <normal not root user> at synology! ( not from WIn ) you can surf into:
/mnt/samba/data/comp

to see what LetoDbf should serve ? -- tell me whats different

## stop here if not !

---

# edit (as root) /etc/letosmb.ini, change:
DataPath = /mnt/samba/data/comp
; add:
Port = 2814


# edit *letodb.ini*, remove HardCommit, and worth a try, add:
Cache_Records = 21


# we collected all info for a new line in: /etc/fstab:
//localhost/bms /mnt/samba cifs auto,guest 0 0

(* above new line with a <newline> at end [Enter] *)


# that way you start LetoDBf server, you start a second:
letodb config letosmb
( Using this syntax need new server )

---
restart Syno - went fine up ?

again check: /mnt/samba/data/comp is there and browseable ?
-----


in your app add *before* the existing leto_connect(),
same procedre for:
Leto_Connect( "//what_you_use:2914/" )

Then do something <exclusive fun>,
maybe open one table excl ...

console what_ip:2914
We have table at right server opened ?

Try samba to open excl ...
...

best regards
Rolf

Ash

unread,
Jan 12, 2018, 1:17:14 PM1/12/18
to Harbour Users
Hello Rolf,

I get the following error. I am using PuTTY.

Regards.
Ash

root@bmsprod:/# mount -t cifs -o guest //localhost/data /mnt/samba
mount: wrong fs type, bad option, bad superblock on //localhost/data,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount.<type> helper program)

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
root@bmsprod:/#

elch

unread,
Jan 12, 2018, 1:28:32 PM1/12/18
to Harbour Users
Hello Ash,

i didn't wrote that ../data -- how does it get there ?

Ash

unread,
Jan 12, 2018, 1:41:20 PM1/12/18
to Harbour Users
Hello Rolf,

My error. I get the same error with bms. 

Here is a script that runs at when DS713+ is powered up. It includes the changes I made to mount the database. These are highlighted.

Regards.
Ash

#!/bin/sh

# Package
PACKAGE="debian-chroot"
DNAME="Debian Chroot"

# Others
INSTALL_DIR="/usr/local/${PACKAGE}"
PATH="${INSTALL_DIR}/bin:${PATH}"
CHROOTTARGET=`realpath ${INSTALL_DIR}/var/chroottarget`


start_daemon ()
{
    # Mount if install is finished
    if [ -f ${INSTALL_DIR}/var/installed ]; then
        # Make sure we don't mount twice
        grep -q "${CHROOTTARGET}/proc " /proc/mounts || mount -t proc proc ${CHROOTTARGET}/proc
        grep -q "${CHROOTTARGET}/sys " /proc/mounts || mount -t sysfs sys ${CHROOTTARGET}/sys
        grep -q "${CHROOTTARGET}/dev " /proc/mounts || mount -o bind /dev ${CHROOTTARGET}/dev
        grep -q "${CHROOTTARGET}/dev/pts " /proc/mounts || mount -o bind /dev/pts ${CHROOTTARGET}/dev/pts
        
        [ ! -d ${CHROOTTARGET}/data ] && mkdir -p ${CHROOTTARGET}/data
        grep -q "${CHROOTTARGET}/volume1/bms " /proc/mounts || mount -o bind /volume1/bms ${CHROOTTARGET}/data
        chroot ${CHROOTTARGET}/ /usr/local/bin/letodb start

        # Start all services
        ${INSTALL_DIR}/app/start.py
    fi
}

stop_daemon ()
{
    # Stop running services
    ${INSTALL_DIR}/app/stop.py

    chroot ${CHROOTTARGET}/ /usr/local/bin/letodb stop

    # Unmount
    umount ${CHROOTTARGET}/dev/pts
    umount ${CHROOTTARGET}/dev
    umount ${CHROOTTARGET}/sys
    umount ${CHROOTTARGET}/proc

    umount ${CHROOTTARGET}/data
}

daemon_status ()
{
    `grep -q "${CHROOTTARGET}/proc " /proc/mounts` && `grep -q "${CHROOTTARGET}/sys " /proc/mounts` && `grep -q "${CHROOTTARGET}/dev " /proc/mounts` && `grep -q "${CHROOTTARGET}/dev/pts " /proc/mounts`
}


case $1 in
    start)
        if daemon_status; then
            echo ${DNAME} is already running
            exit 0
        else
            echo Starting ${DNAME} ...
            start_daemon
            exit $?
        fi
        ;;
    stop)
        if daemon_status; then
            echo Stopping ${DNAME} ...
            stop_daemon
            exit 0
        else
            echo ${DNAME} is not running
            exit 0
        fi
        ;;
    status)
        if daemon_status; then
            echo ${DNAME} is running
            exit 0
        else
            echo ${DNAME} is not running
            exit 1
        fi
        ;;
    chroot)
        chroot ${CHROOTTARGET}/ /bin/bash
        ;;
    *)
        exit 1
        ;;
esac

elch

unread,
Jan 12, 2018, 3:06:14 PM1/12/18
to Harbour Users
Hello Ash,

...
        grep -q "${CHROOTTARGET}/dev/pts " /proc/mounts || mount -o bind /dev/pts ${CHROOTTARGET}/dev/pts 
        
grep -q "${CHROOTTARGET}/mnt " /proc/mounts || mount -o bind /mnt ${CHROOTTARGET}/mnt 
        [ ! -d ${CHROOTTARGET}/data ] && mkdir -p ${CHROOTTARGET}/data


--> to let /mnt show up in jail sounds a good point

 
        grep -q "${CHROOTTARGET}/volume1/bms " /proc/mounts || mount -o bind /volume1/bms ${CHROOTTARGET}/data 
        chroot ${CHROOTTARGET}/ /usr/local/bin/letodb start
 
chroot ${CHROOTTARGET}/ /usr/local/bin/letodb config letosmb

...
    ${INSTALL_DIR}/app/stop.py

    chroot ${CHROOTTARGET}/ /usr/local/bin/letodb stop
chroot ${CHROOTTARGET}/ /usr/local/bin/letodb stop letosmb


-----
But we are not ready!

for
sudo mount -t cifs -o guest //localhost/data /mnt/samba

play with IP-address/ DNS-NAME instead 'localhost'.
or additional option:
-o guest,workgroup=delos

what response shows for command:
mount.cifs
--> something help text ?

----
I may need a bit research ...

Rolf

elch

unread,
Jan 12, 2018, 4:30:37 PM1/12/18
to Harbour Users
Hello Ash,

drag/droped by bad occasion your wrong line:
sudo mount -t cifs -o guest //localhost/data /mnt/samba
sincerly share name bms, not data

elch

unread,
Jan 13, 2018, 4:34:44 AM1/13/18
to Harbour Users
Hello Ash,

a note in front:
using (not out-commented) the two 'cflag's in the rddleto[addon].hbp,
forcible needs a second LetoDBf -- can't use them if this not available.

---
We should determine, if your NAS OS is ready upset to mount a Samba share.
( Serving a share with Samba <> to mount a share in Linux - are different tools )

Therefor was this test [the dot no typo]
mount.cifs
--> something help text ?

-----
If not, we can try to install a package <cifs-utils> for your OS.
Installing packages depend on Linux version ??:
uname -a

---
[following commands need to be done as root_user - users need 'sudo' in front]

As Debian chroot-package is used, i would expect .deb package mangement.
These two commands without param:
apt-get
dpkg
are available, give some feedback ?


The NAS itself can get internet access ? -- then easy:
apt-get install cifs-utils

A bit harder way is to search the OS version correct .deb package in internet,
to download and copy it onto the NAS and then:
dpkg -i /path/to/file.deb

lets see how far you got ...
Rolf

Ash

unread,
Jan 13, 2018, 8:33:45 AM1/13/18
to Harbour Users
Hello Rolf,

NAS was angry. Had to recover.

In chroot

apt-get update
apt-get upgrade
apt-get install cifs-utils

All command executed without errors.

Regards.
Ash

elch

unread,
Jan 14, 2018, 4:03:08 AM1/14/18
to Harbour Users
Hello Ash,

NAS was angry. Had to recover.
before ? - or afterwards ? -  below command ? 
...
apt-get install cifs-utils

If before, you afterwards could mount the 'share' like suggested,
to get content into: /mnt/samba/comp  [ without 'data' in between ],
and could continue with this little adaption the rest ?

best regards
Rolf

Ash

unread,
Jan 14, 2018, 10:25:18 AM1/14/18
to Harbour Users
Hello Rolf,

before ? - or afterwards ? -  below command ? 
Before.  NAS was restored to January 5th. I then installed cifs-utils in chroot jail as indicated above.

There are two places where OS appears to be installed:
/
/volume1/@appstore/debian-chroot/var/chroottarget/

The second one being in chroot jail. etc/samba folder appears in both places. As shares are only defined in NAS OS /etc/samba folder, I am assuming that /jail/etc/samba folder is not being used. This is where I got lost.

I have downloaded the latest LetoDBf and built everything with the following two defines:

-cflag="-DLETO_SMBSERVER=localhost"
-cflag="-DLETO_SMBPORT=2814"

Created /mnt/samba folder.
Adjusted letodb.ini and letosmb.ini as you suggested.
Restarted NAS.

root@bmsprod:/# mount -t cifs -o guest //localhost/bms /mnt/samba
mount error(95): Operation not supported
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
root@bmsprod:/#

 
Regards.
Ash

elch

unread,
Jan 14, 2018, 11:15:59 AM1/14/18
to Harbour Users
Hello Ash,


There are two places where OS appears to be installed:
/
/volume1/@appstore/debian-chroot/var/chroottarget/

The second one being in chroot jail. etc/samba folder appears in both places. As shares are only defined in NAS OS /etc/samba folder, I am assuming that /jail/etc/samba folder is not being used. This is where I got lost.

IMO the error message would be different, if a 'share' definition is not found.
Sound like a different setup quirk, to solve or not to solve ...
 
root@bmsprod:/# mount -t cifs -o guest //localhost/bms /mnt/samba
mount error(95): Operation not supported
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
root@bmsprod:/#

If i google for this: 'mount error(95)'
one found suggest was:
mount -t cifs -o guest,sec=ntlmssp //localhost/bms /mnt/samba

If not working, check the last 1-3 lines of:
dmesg
for additional info about the error.

Basically it seems we need to experiment with that options [-o] part.
If found the correct ones, all these go into the fstab entry, together with an auto,
in example: auto,guest,sec=ntlmssp

best regards
Rolf

elch

unread,
Jan 14, 2018, 11:34:48 AM1/14/18
to Harbour Users
addendum:

If i google for this: 'mount error(95)'
more finds:

mount -t cifs -o guest,sec=ntlm //localhost/bms /mnt/samba
mount -t cifs -o guest,sec=ntlm,vers=3.0 //localhost/bms /mnt/samba
...

Ash

unread,
Jan 14, 2018, 2:36:09 PM1/14/18
to Harbour Users
Hello Rolf,

Here is some further progress but unable to get to comp folder.

root@bmsprod:/# mount -t cifs -o username=admin,password=xxxxxx //localhost/bms /mnt/samba
root@bmsprod:/# dir /mnt/samba
Accounts.txt        bg.png  comp-old  @eaDir  Thumbs.db
?.Accounts.txt.swp  comp    comp.zip  scan    win64_153633.4578.exe
root@bmsprod:/# dir /mnt/samba/comp
dir: cannot access /mnt/samba/comp: No such file or directory
root@bmsprod:/#

elch

unread,
Jan 14, 2018, 3:09:39 PM1/14/18
to Harbour Users
Hello Ash,

We can try set user- and group-id to first standard user, plus file- and dir- access rights to all is allowed,
# about ,iocharset=utf8 i am a bit unsure, but sound not bad
# nounix is new to me, found on a list of suggestions

mount -t cifs -o username=admin,password=xxxxxx,iocharset=utf8,gid=1000,uid=1000,nounix,file_mode=0777,dir_mode=0777 //localhost/bms /mnt/samba

best regards
Rolf

Ash

unread,
Jan 14, 2018, 3:48:47 PM1/14/18
to Harbour Users
Hello Rolf,

This command works. I can see all the files and folders.

What changes must I make to my application to have this mechanism work?

Regards.
Ash

elch

unread,
Jan 14, 2018, 4:31:19 PM1/14/18
to Harbour Users
Hello Ash,

if RDD lib is created with these two cflags, [ LETO_SMB... ]

you just connect *also* to the <exclusive> server,
best done before the existing Leto_Connect().

Then test some exclusive action,
countercheck with monitor that excl file is opened at excl server:2914


best regards
Rolf

elch

unread,
Jan 14, 2018, 4:33:44 PM1/14/18
to Harbour Users
correction:

countercheck with monitor that excl file is opened at excl server:2914
port 2814 we choosed

elch

unread,
Jan 14, 2018, 4:52:03 PM1/14/18
to Harbour Users
Ups,

this i missed, sorry:
the connection address/port for exclusive server must be the same as given in .hbp's
aka connect to leto_connect( "//localhost:2814/" )

best regards
Rolf

elch

unread,
Jan 14, 2018, 4:58:10 PM1/14/18
to Harbour Users
Hello Ash,

and this also won't work :-(
Adapt in the rddleto[addon].hbp the IP-Address/ DNS-name to connect,
for this LETO_SMBSERVER setting

rebuild lib and app ...

best regards
Rolf

Ash

unread,
Jan 15, 2018, 6:40:06 AM1/15/18
to Harbour Users
Hello Rolf,

Here are the contents of log file.

01.15.2018 06:15:01       LetoDBf Server try to start ...
01.15.2018 06:15:01       UDF file: /usr/local/bin/letoudf.hrb not present.
01.15.2018 06:15:01 INFO: LetoDBf Server 3.00, will run at port :2812 ( internal also used :2813 )
01.15.2018 06:15:01 INFO: DataPath=/data/comp, ShareTables=1, NoSaveWA=1, max database=999
01.15.2018 06:15:01 INFO: LoginPassword=0, CacheRecords=30, LockExtended=0
01.15.2018 06:15:01       LetoDBf Server try to start ...
01.15.2018 06:15:01       UDF file: /usr/local/bin/letoudf.hrb not present.
01.15.2018 06:15:01 INFO: LetoDBf Server 3.00, will run at port :2814 ( internal also used :2815 )
01.15.2018 06:15:01 INFO: DataPath=/mnt/samba, ShareTables=1, NoSaveWA=1, max database=999
01.15.2018 06:15:01 INFO: LoginPassword=0, CacheRecords=30, LockExtended=0

Application ends with the following error when it tries to open company.dbf in exclusive mode.

Subsystem Call ....: LETO
System Code .......: 1021
Default Status ....: .T.
Description .......: Open error
Operation .........: 
Arguments .........: 
Involved File .....: \company
OS Error Code .....: 0

Regards.
Ash

elch

unread,
Jan 15, 2018, 8:10:45 AM1/15/18
to Harbour Users
Hello Ash.
...
01.15.2018 06:15:01 INFO: LetoDBf Server 3.00, will run at port :2812 ( internal also used :2813 )
01.15.2018 06:15:01 INFO: DataPath=/data/comp, ShareTables=1, NoSaveWA=1, max database=999
...
01.15.2018 06:15:01 INFO: LetoDBf Server 3.00, will run at port :2814 ( internal also used :2815 )
01.15.2018 06:15:01 INFO: DataPath=/mnt/samba, ShareTables=1, NoSaveWA=1, max database=999

Thats looks promising !


Application ends with the following error when it tries to open company.dbf in exclusive mode.
Subsystem Call ....: LETO
System Code .......: 1021
Description .......: Open error
 
would be expected to look such alike, if the second connection is not found
I assume you verified, that you LetoConnect() to identical! address/name
for exclusive server, as given in LETO_SMBSERVER in hbp before lib building.

---
Use console monitor, connect to exclusive server, set debug level to 21
-- do not close the monitor ...

Start your app, set you a breakpoint (inkey?) before that exclusive open:
check monitor for the connection is opened ?
Just after the failed exclusive open, check in monitor the log [ ALT-L ]
for the connection: there must be something!, that i like to see ...

( as both server actually use same log path [ we may adapt later ],
the just seen log is letodbf_xx.log in known log path )

best regards
Rolf

elch

unread,
Jan 15, 2018, 8:16:57 AM1/15/18
to Harbour Users
Hello Ash,

i got it !!?
...
01.15.2018 06:15:01 INFO: LetoDBf Server 3.00, will run at port :2814 ( internal also used :2815 )
01.15.2018 06:15:01 INFO: DataPath=/mnt/samba, ShareTables=1, NoSaveWA=1, max database=999
i bet!, that your DBFs are not in that path, but in:
/mnt/samba/comp

Am i right ?
Rolf

Ash

unread,
Jan 15, 2018, 8:42:51 AM1/15/18
to Harbour Users
i bet!, that your DBFs are not in that path, but in:
/mnt/samba/comp
Yes.

elch

unread,
Jan 15, 2018, 3:30:14 PM1/15/18
to Harbour Users
Hello Ash,

i assume since fourteen fourty-two all is <exlusive> fine ?
BTW, let me know if the changed letodb.ini 'performs!' ?

---
Afterworks:
# using same log-path for <two> servers -- quite ok 'in production'!
Level maybe set to '0' (only error) in letosmb.ini:
Debug = 0

# would like test to downgrade DATA file rights in /etc/fstab to:
.. file_mode=0666 ..
[ ReadWrite, no Exe ]

# login to samba as this user/ password - looks a bit unconfigured ;-)

-----
# IMHO the exclusive LetoSMB must not run in jail,
as data used by it is an 'internal affair'.
Quite in opposite, as it let a source public double appear:
one time in /data/comp, other in /mnt/samba/comp

Task would be to add an init-script, handling 'LetoSMB' up and down.
Not complex, it must only happen after Samba have started,
to get a valid datapath ...

'Out of the blue', do as root:

# if not! exist:
mkdir /usr/local/etc/rc.d

#put attached as:
/usr/local/etc/rc.d/letodb.sh

# exezise
chmod 755 /usr/local/etc/rc.d/letodb.sh

# leave as fallback, outcomment second letodbf start/stop in jail,
and also the line making /mnt viewable ...

reboot ... check letodbf.log .. .try connect

best regards
Rolf
letodb.sh

Ash

unread,
Jan 15, 2018, 3:52:48 PM1/15/18
to Harbour Users
Hello Rolf,

I changed the DataPath to /mnt/samba/comp but still it did work.

For some reason I am unable to open a table in exclusive mode. Here is an example I tried but it end with an error

Error LETO/1021  Open Error: comp/sysdata

Regards.
Ash

#include "rddleto.ch"

REQUEST LETO

PROCEDURE main( )

   rddSetDefault( "LETO" )


   IF leto_Connect( "//192.168.2.200:2812/" ) < 0
      ALERT( "NO LETODB SERVER FOUND - ERROR: " + leto_Connect_Err( .T. ) )
      QUIT
   ENDIF
   IF leto_Connect( "//192.168.2.200:2814/" ) < 0
      Alert( 'No 2814.' )
   ENDIF

   hb_alert( leto_directory('/')[1])

   USE 'comp/sysdata' NEW
   IF NetErr()
      ? 'Cannot open file.'
      inkey(0)
   ENDIF

RETURN

elch

unread,
Jan 15, 2018, 4:05:38 PM1/15/18
to Harbour Users
Hello Ash,

strongly suggested to connect to 2814 *before* 2812, to avoid extra switch back to default connection.
Your snippet will let all happen at exclusive server.

To get further, need to see server log as described,
to give me a perhaps a slight hint ...

best regards
Rolf

elch

unread,
Jan 15, 2018, 4:33:34 PM1/15/18
to Harbour Users
Hello Ash,

I changed the DataPath to /mnt/samba/comp but still it did work.
...
Error LETO/1021  Open Error: comp/sysdata
...
   USE 'comp/sysdata' NEW


another bet!, billed we be later 8-)

Old absolute path was:
/data/comp
now the content will appear in absolute path
/mnt/samba/comp

and server now try to open for your snippet:
/mnt/samba/comp/comp/sydata,dbf
and the log says: file not found ?

Am i again right ?
Rolf

Ash

unread,
Jan 16, 2018, 6:14:52 AM1/16/18
to Harbour Users
Hello Rolf,

Let us document as to what I have done so far.

Regards.
Ash

Lib/Server compiled with

#outcomment both! to burn LetoDBf address for exclusive usage
-cflag="-DLETO_SMBSERVER=bmsprod"
-cflag="-DLETO_SMBPORT=2814"

letodb.ini

[Main]
DataPath = /data/comp
LogPath = /var/log/letodb         
EnableFileFunc = 1
EnableUDF = 1 
Cache_Records = 30
TimeOut = -1
No_Save_WA = 1
Share_Tables = 1

letosmb.ini

[Main]
DataPath = /mnt/samba/comp
Port = 2814
LogPath = /var/log/letodb         
EnableFileFunc = 1
EnableUDF = 1 
Cache_Records = 30
TimeOut = -1
No_Save_WA = 1
Share_Tables = 1

start-stop-status script that gets executed at NAS startup. Slightly altered.

#!/bin/sh

# Package
PACKAGE="debian-chroot"
DNAME="Debian Chroot"

# Others
INSTALL_DIR="/usr/local/${PACKAGE}"
PATH="${INSTALL_DIR}/bin:${PATH}"
CHROOTTARGET=`realpath ${INSTALL_DIR}/var/chroottarget`


start_daemon ()
{
    # Mount if install is finished
    if [ -f ${INSTALL_DIR}/var/installed ]; then
        # Make sure we don't mount twice
        grep -q "${CHROOTTARGET}/proc " /proc/mounts || mount -t proc proc ${CHROOTTARGET}/proc
        grep -q "${CHROOTTARGET}/sys " /proc/mounts || mount -t sysfs sys ${CHROOTTARGET}/sys
        grep -q "${CHROOTTARGET}/dev " /proc/mounts || mount -o bind /dev ${CHROOTTARGET}/dev
        grep -q "${CHROOTTARGET}/dev/pts " /proc/mounts || mount -o bind /dev/pts ${CHROOTTARGET}/dev/pts
        
        [ ! -d ${CHROOTTARGET}/data ] && mkdir -p ${CHROOTTARGET}/data
        grep -q "${CHROOTTARGET}/volume1/bms " /proc/mounts || mount -o bind /volume1/bms ${CHROOTTARGET}/data
        chroot ${CHROOTTARGET}/ /usr/local/bin/letodb start

        [ ! -d ${CHROOTTARGET}/mnt/samba ] && mkdir -p ${CHROOTTARGET}//mnt/samba
        grep -q "${CHROOTTARGET}/volume1/bms " /proc/mounts || mount -o bind /volume1/bms ${CHROOTTARGET}/mnt/samba
        chroot ${CHROOTTARGET}/ /usr/local/bin/letodb config letosmb

        # Start all services
        ${INSTALL_DIR}/app/start.py
    fi
}

stop_daemon ()
{
    # Stop running services
    ${INSTALL_DIR}/app/stop.py

    chroot ${CHROOTTARGET}/ /usr/local/bin/letodb stop
    chroot ${CHROOTTARGET}/ /usr/local/bin/letodb stop letosmb

    # Unmount
    umount ${CHROOTTARGET}/dev/pts
    umount ${CHROOTTARGET}/dev
    umount ${CHROOTTARGET}/sys
    umount ${CHROOTTARGET}/proc

    umount ${CHROOTTARGET}/data
    umount ${CHROOTTARGET}/mnt/samba
Just to confirm that files are seen in both folders.

root@bmsprod:/# ls /data
Accounts.txt  comp      comp.zip  scan       win64_153633.4578.exe
bg.png        comp-old  @eaDir    Thumbs.db

root@bmsprod:/# ls /mnt/samba
Accounts.txt  comp      comp.zip  scan       win64_153633.4578.exe
bg.png        comp-old  @eaDir    Thumbs.db

Test program that ends in 'Open' error.

#include "rddleto.ch"

REQUEST LETO, DBFCDX

PROCEDURE main( )

   rddSetDefault( "LETO" )

   IF leto_Connect( "//192.168.2.200:2814/" ) < 0
      hb_Alert( 'No 2814.' )
      QUIT
   ENDIF

   IF leto_Connect( "//192.168.2.200:2812/" ) < 0
      hb_Alert( 'No 2812.' )
      QUIT
   ENDIF

   USE sysdata NEW

   hb_Alert( NetErr() )

RETURN

elch

unread,
Jan 16, 2018, 6:41:03 AM1/16/18
to Harbour Users
Hello Ash,

#outcomment both! to burn LetoDBf address for exclusive usage
-cflag="-DLETO_SMBSERVER=bmsprod"
...

   IF leto_Connect( "//192.168.2.200:2814/" ) < 0

Not identical server name !
-->
IF leto_Connect( "//bmsprod:2814/" ) < 0

best regards
Rolf

Ash

unread,
Jan 16, 2018, 6:57:02 AM1/16/18
to Harbour Users
Hello Rolf,

bmsprod = 192.168.2.200 in my setup here.

However, I tried with //bmsprod:2814 and still get the same error.

Regards.
Ash

elch

unread,
Jan 16, 2018, 7:07:02 AM1/16/18
to Harbour Users
Hello Ash,


bmsprod = 192.168.2.200 in my setup here.
compared as string they are not identical ...
 
However, I tried with //bmsprod:2814 and still get the same error.
Then i need more detailed error feedback.

----

Use console monitor, connect to exclusive server, set debug level to 21
-- do not close the monitor ...

Start your app, set you a breakpoint (inkey?) before that exclusive open:
check monitor for the connection is opened ?
Just after the failed exclusive open, check in monitor the log [ ALT-L ]
for the connection: there must be something!, that i like to see ...

best regards
Rolf

Ash

unread,
Jan 16, 2018, 7:28:25 AM1/16/18
to Harbour Users
Hello Rolf,

Log files at various points.

Regards.
Ash

letodbf.log

01.16.2018 05:34:00       LetoDBf Server try to start ...
01.16.2018 05:34:00       UDF file: /usr/local/bin/letoudf.hrb not present.
01.16.2018 05:34:00 INFO: LetoDBf Server 3.00, will run at port :2812 ( internal also used :2813 )
01.16.2018 05:34:00 INFO: DataPath=/data/comp, ShareTables=1, NoSaveWA=1, max database=999
01.16.2018 05:34:00 INFO: LoginPassword=0, CacheRecords=30, LockExtended=0
01.16.2018 05:34:00       LetoDBf Server try to start ...
01.16.2018 05:34:00       UDF file: /usr/local/bin/letoudf.hrb not present.
01.16.2018 05:34:00 INFO: LetoDBf Server 3.00, will run at port :2814 ( internal also used :2815 )
01.16.2018 05:34:00 INFO: DataPath=/mnt/samba/comp, ShareTables=1, NoSaveWA=1, max database=999
01.16.2018 05:34:00 INFO: LoginPassword=0, CacheRecords=30, LockExtended=0
01.16.2018 07:12:38 INFO: connected  192.168.2.12:51343 flt.exe CP: EN  DF: mm/dd/yy  conn-ID 1
01.16.2018 07:12:38 DEBUG leto_Intro() AUTO -open 1 -order 0 DEFAULT '/data/comp' PATH ''
01.16.2018 07:22:08 INFO: disconnect 192.168.2.12:51343 flt.exe users=(2 : 2 : 2), tables=(0 : 1)
01.16.2018 07:25:00 INFO: disconnect 192.168.2.12:51334 console.exe users=(1 : 1 : 2), tables=(0 : 1)
letodbf_00.log.atinkey
letodbf_00.log.aftererror

elch

unread,
Jan 16, 2018, 7:53:06 AM1/16/18
to Harbour Users
Hello Ash,

that are the logs of the monitor connection.

If monitor before the app connects to the excl. server:

then it must appear a second! connection, that for your app.
This log will then go into: letodbf_01.log.
To view it 'live', select in browse: connections this connection before ALT-L.

---
If Debug level in letosmb.ini is still not set to '0',
i would expect *2* lines with "INFO: connected ... flt.exe .." in letodbf.log (server itself)

best regards
Rolf

Ash

unread,
Jan 16, 2018, 9:00:05 AM1/16/18
to Harbour Users
Hello Rolf,

Is this you are looking for? 

Regards.
Ash

01.16.2018 08:49:43       LetoDBf Server try to start ...
01.16.2018 08:49:43       UDF file: /usr/local/bin/letoudf.hrb not present.
01.16.2018 08:49:43 INFO: LetoDBf Server 3.00, will run at port :2812 ( internal also used :2813 )
01.16.2018 08:49:43 INFO: DataPath=/data/comp, ShareTables=1, NoSaveWA=1, max database=999
01.16.2018 08:49:43 INFO: LoginPassword=0, CacheRecords=30, LockExtended=0
01.16.2018 08:49:43       LetoDBf Server try to start ...
01.16.2018 08:49:43       UDF file: /usr/local/bin/letoudf.hrb not present.
01.16.2018 08:49:43 INFO: LetoDBf Server 3.00, will run at port :2814 ( internal also used :2815 )
01.16.2018 08:49:43 INFO: DataPath=/mnt/samba/comp, ShareTables=1, NoSaveWA=1, max database=999
01.16.2018 08:49:43 INFO: LoginPassword=0, CacheRecords=30, LockExtended=0
01.16.2018 08:53:43 INFO: connected  192.168.2.12:51859 flt.exe CP: EN  DF: mm/dd/yy  conn-ID 1
01.16.2018 08:53:43 DEBUG leto_Intro() AUTO -open 1 -order 0 DEFAULT '/mnt/samba/comp' PATH ''
01.16.2018 08:54:48 INFO: disconnect 192.168.2.12:51859 flt.exe users=(2 : 2 : 2), tables=(0 : 0)
01.16.2018 08:56:44 INFO: connected  192.168.2.12:51864 console.exe CP: EN  DF: mm/dd/yy  conn-ID 1
01.16.2018 08:56:44 DEBUG leto_Intro() AUTO -open 1 -order 0 DEFAULT '/mnt/samba/comp' PATH ''
01.16.2018 08:56:44 DEBUG thread3() 2. socket for client at address: 192.168.2.200:2814 :51864

elch

unread,
Jan 16, 2018, 9:43:42 AM1/16/18
to Harbour Users
Hello Ash,

alike:
... << open: (len xx)
... O;sydata;..
... DEBUG leto_InitArea( ...
? her comes the answer of server ?

But something fundamental must fail, when you show me again letodbf.log
( log of the server itself )

I would like you to verify, that you can open that DBF in shared! mode.
This do BEFORE the exclusive try.
Watch it perhaps with: console 192.168.2.200:2812

IF DbUseArea( .T.,, "sysdata",,.T. )
   INKEY(0)
   DbCloseArea()
ELSE
   ALERT( "CHECK!")
ENDIF

Rolf

Ash

unread,
Jan 16, 2018, 12:16:01 PM1/16/18
to Harbour Users
Hello Rolf,

letodbf.log

01.16.2018 10:35:26 INFO: connected  192.168.2.12:52198 flt.exe CP: EN  DF: mm/dd/yy  conn-ID 1
01.16.2018 10:35:26 DEBUG leto_Intro() AUTO -open 1 -order 0 DEFAULT '/mnt/samba/comp' PATH ''
01.16.2018 10:35:26 INFO: connected  192.168.2.12:52199 flt.exe CP: EN  DF: mm/dd/yy  conn-ID 1
01.16.2018 10:35:26 DEBUG leto_Intro() AUTO -open 1 -order 0 DEFAULT '/data/comp' PATH ''
01.16.2018 10:39:41 INFO: disconnect 192.168.2.12:52199 flt.exe users=(2 : 2 : 2), tables=(0 : 1)

letodbf_01.log

01.16 10:36:15.633 +01.16 10:35:26.789 << open: (len 40)
01.16 10:35:26.789 O;sysdata;SYSDATA;TF;;DBFCDX;1;mm/dd/yy;
01.16 10:35:26.789 DEBUG leto_InitArea( connect:2, area:1, alias:SYSDATA, not detached:1 -- request:SYSDATA)
01.16 10:35:26.789 +1;0;.cdx;.fpt;2;3;64;3;2458009;14;DATEFORM;C;1;0;DEFSHIPVIA;C;3;0;BARCODE;L;1;0;SITE;C;50;0;EMAIL;C;50;0;EPWD;C;15;0;SMTP;C;50;0;PORT;C;4;0;CCEMAIL;C;50;0;LOG;L;1;0;EMMSG;C;254;0;PRNTCOPY;L;1;0;AUTOQUIT;N;3;0;EXPDT;D;8;0;0;

Regards.
Ash

elch

unread,
Jan 16, 2018, 1:11:21 PM1/16/18
to Harbour Users
Hello Ash,

that is a shared, successful ! opened sysdata.dbf -- fine so far !

---
Similar should happen at :2814, if the table is wanted exclusive to open.
With at least an error feedback, why it can't be opened.
Verify in console 192.168.2.200:2814
*if* there is action, when table is tried to open.

If there is *none* action at :2814, when table is (tried to) opened,
the exclusive server can not be found in
source/client/letocl.c:3491
For this case of !none! action, we take the hard tour:
in line 3487/3489 you find a #ifdef/ #endif pair.
Comment out these both lines with // at front -- recompile library + snippet.
Run snippet to get a "flt.log" where the flt.exe is located.
What's in there ?

best regards
Rolf

letodbf_01.log

01.16 10:36:15.633 +01.16 10:35:26.789 << open: (len 40)
01.16 10:35:26.789 O;sysdata;SYSDATA;TF;;DBFCDX;1;mm/dd/yy;
01.16 10:35:26.789 DEBUG leto_InitArea( connect:2, area:1, alias:SYSDATA, not detached:1 -- request:SYSDATA)
01.16 10:35:26.789 +1;0;.cdx;.fpt;2;3;64;3;2458009;14;........  

elch

unread,
Jan 16, 2018, 1:14:52 PM1/16/18
to Harbour Users
to clarify:

in line 3487/3489 you find a #ifdef/ #endif pair.
Comment out these both lines with // at front -- recompile library + snippet.
i want this line in between to get into action ...
 

Ash

unread,
Jan 16, 2018, 1:37:52 PM1/16/18
to Harbour Users
Hello Rolf,

flt.log

LetoDbOpenTable() redirect to server bmsprod:2814

Regards.
Ash

elch

unread,
Jan 16, 2018, 1:48:46 PM1/16/18
to Harbour Users
Hello Ash,

exactly as it should be!

If you now have connected at app start to:
leto_Connect( "//bmsprod:2814/" )
server must be found!, aka there must be action at :2814

[ background: server are ever identified/handled by their 'string' name,
DNS name resolution only happens in the moment a connection is physically established ]

here i have actually no further idea

best regards
Rolf

elch

unread,
Jan 16, 2018, 1:59:09 PM1/16/18
to Harbour Users
Hello Ash,

you can check that at PRG level,
after both Leto_Connect()'s are done.

This way a active connection can be selected:
Leto_Connect( "//bmsprod:2812/" )  --> 1
Leto_Connect( "//bmsprod:2814/" )  --> 0

Above uses the same logic ...

best regards
Rolf

Ash

unread,
Jan 16, 2018, 2:42:51 PM1/16/18
to Harbour Users
Hello Rolf,

Leto_Connect( "//bmsprod:2812/" )  --> 1
Leto_Connect( "//bmsprod:2814/" )  --> 0

Correct.

Regards.
Ash

Ash

unread,
Jan 17, 2018, 7:34:55 AM1/17/18
to Harbour Users
Hello Rolf,

The following snippet displays the contents of the file indicating it is accessible via port 2814.

Regards.
Ash

#include "rddleto.ch"

REQUEST LETO, DBFCDX

PROCEDURE main( )

   rddSetDefault( "LETO" )

   IF leto_Connect( "//bmsprod:2814/" ) < 0
      hb_Alert( 'No 2814.' )
      QUIT
   ENDIF

   hb_alert(Leto_memoread( "sysdata.dbf" ) )

RETURN
Message has been deleted

elch

unread,
Jan 17, 2018, 9:23:56 AM1/17/18
to Harbour Users
Hello Ash,

yes, i <believe> so far its 'possible' ...

[and won't explain these *two* leto_ConnectionFind() as needs more words they're short]

best regards
Rolf


Am Mittwoch, 17. Januar 2018 13:34:55 UTC+1 schrieb Ash:
Hello Rolf,

snip.jpg

elch

unread,
Jan 17, 2018, 9:41:03 AM1/17/18
to Harbour Users
Hello Ash,

/etc/fstab
# about ,iocharset=utf8 i am a bit unsure, but sound not bad
maybe here hides a problem -- but in ANY case i would expect 'action' at :2814

best regards
Rolf
Message has been deleted

Ash

unread,
Jan 17, 2018, 2:26:51 PM1/17/18
to Harbour Users
Hello Rolf,

flt.log file was not created.

Regards.
Ash


On Wednesday, January 17, 2018 at 1:59:15 PM UTC-5, elch wrote:
Hello Ash,

to prove my hypothesis,
you move line 3488 [ leto_clientlog(...) ] in source/client/letocl.c
below the following 5 lines, aka after 3495, but before the bracket '}'.

Then you won't get a 'flt.log' in case the server is not 'found'.
If you get a flt.log ( my assumption ), there must action at :2814
with error feedback in letodbf_xx.log after changing debug level.

best regards
Rolf
Message has been deleted

Ash

unread,
Jan 17, 2018, 3:11:24 PM1/17/18
to Harbour Users
Hello Rolf,

The following snippet works.  Well done.

I will now start testing my application.

Regards.
Ash

#include "rddleto.ch"

REQUEST LETO, DBFCDX

PROCEDURE main( )

   rddSetDefault( "LETO" )

   IF leto_Connect( "//192.168.2.200:2814/" ) < 0
      hb_Alert( 'No 2814.' )
      QUIT
   ENDIF

   IF leto_Connect( "//192.168.2.200:2812/" ) < 0
      hb_Alert( 'No 2812.' )
      QUIT
   ENDIF

   IF DbUseArea( .T.,, "sysdata",,.T. )
      //browse()
      INKEY(0)
      DbCloseArea()
   ELSE
      ALERT( "CHECK!")
   ENDIF

   USE sysdata NEW

   hb_Alert( NetErr() )

RETURN

On Wednesday, January 17, 2018 at 2:41:20 PM UTC-5, elch wrote:
Hello Ash,

just caught myself ;-)

Please use IP-address for LETO_SMBSERVER in rddletoaddon.hbp
and for leto_connect()

I will start thinking if and how we can use DNS name ...

best regards
Rolf

Ash

unread,
Jan 17, 2018, 3:25:08 PM1/17/18
to Harbour Users
Hello Rolf,

This message found in letodbf_01.log file.

01.17 15:20:56.291       Error DBCMD/1010  Illegal characters in alias: COMPK\CTRL

Replacing '\' with '/' removes the error.

Regards.
Ash
Message has been deleted

Ash

unread,
Jan 18, 2018, 8:19:57 AM1/18/18
to Harbour Users
Hello Rolf,

Testing exclusive use of a table. z: points to bms share.

Regards.
Ash

FLTN.PRG - first run is displaying browse() screen, left it there. Second run raises 'Cannot open file' message. Test OK. 

// hbmk2 fltn.prg rddleto.hbc -ie:\letodbf\include

REQUEST LETO, DBFCDX

PROCEDURE main( )

   rddSetDefault( "DBFCDX" )

   USE z:\comp\sysdata NEW
   IF NetErr()
      ? 'Cannot open file.'
      inkey(0)
   ELSE
      browse()
   ENDIF

   RETURN

FLT.PRG - first run is displaying browse() screen, left it there. Second run displays the following error message:

┌──────────────────────────────────────────┐
│   Error LETO/1021  Open error: sysdata   │
│                                          │
│         Quit    Retry    Default         │
└──────────────────────────────────────────┘

// hbmk2 flt.prg rddleto.hbc -ie:\letodbf\include

#include "rddleto.ch"

REQUEST LETO, DBFCDX

PROCEDURE main( )

   rddSetDefault( "LETO" )

   IF leto_Connect( "//bmsprod:2814/" ) < 0
      hb_Alert( 'No 2814.' )
      QUIT
   ENDIF

   IF leto_Connect( "//bmsprod:2812/" ) < 0
      hb_Alert( 'No 2812.' )
      QUIT
   ENDIF

   IF NetErr()
      ? 'Cannot open file.'
      inkey(0)
   ELSE
      browse()
   ENDIF

   RETURN

On Wednesday, January 17, 2018 at 7:33:16 PM UTC-5, elch wrote:
Hello Ash,

? that was a filename containing a Win drive letter ?
Please revert change and check against newest upload.
[ old logic could be also tricked out by: X:/path\test  /o\ ]
Let me know if bug! is not fixed.

With newest upload you should be able to use a DNS name [ 'bmsprod' ]
for LETO_SMBSERVER in the hbp.
You then also can LetoConnect() to an IP, now it should be the equal.
Please test ...

best regards
Rolf
Message has been deleted

Ash

unread,
Jan 18, 2018, 10:23:37 AM1/18/18
to Harbour Users
Hello Rolf,

Last two tests run OK.

New Test - Run flt.exe and fltn.exe. Both can browse the table at the same time. Not good.

Regards.
Ash


On Thursday, January 18, 2018 at 9:53:38 AM UTC-5, elch wrote:
Hello Ash,

you mean the RTE instead of a 'silent' NetErr() ?:
i overlooked, that 'shared error' was set for the switched connection,
and the calling function doesn't know about.

The good news: now you can *not* open a table exclusive,
which is already opened shared.or exclusive.

But not vice versa:
you anytime can open a table shared, even SMBSERVER have it opened exclusive.
This is what i would expect -- i announced respect of each others exclusive.

best regards
Rolf
Message has been deleted

Ash

unread,
Jan 20, 2018, 7:06:00 AM1/20/18
to Harbour Users
Hello Rolf,

Results of 'smbstatus -L' command.

root@bmsprod:~# smbstatus -L
Locked files:
Pid          Uid        DenyMode   Access      R/W        Oplock           SharePath   Name   Time
--------------------------------------------------------------------------------------------------
17682        0          DENY_ALL   0x12019f    RDWR       NONE             /volume1/bms   comp/sysdata.dbf   Sat Jan 20 06:50:25 2018
17682        0          DENY_NONE  0x80        RDONLY     NONE             /volume1/bms   .   Sat Jan 20 06:50:04 2018
17682        0          DENY_NONE  0x100081    RDONLY     NONE             /volume1/bms   scan   Sat Jan 20 06:50:18 2018
17682        0          DENY_NONE  0x100081    RDONLY     NONE             /volume1/bms   scan   Sat Jan 20 06:50:18 2018

and from within chroot jail.

root@bmsprod:~# /var/packages/debian-chroot/scripts/start-stop-status chroot
root@bmsprod:/# smbstatus -L
No locked files

Regards.
Ash


On Friday, January 19, 2018 at 2:35:25 PM UTC-5, elch wrote:
Hello Ash,

Last two tests run OK.
New Test - Run flt.exe and fltn.exe. Both can browse the table at the same time. Not good.

please show me in that moment:
smbstatus -L

---
I may need to do more, needs a bit time. I'm just testing following:
exclusive -> redirect connection to exclusive server
shared -> open table at both server, to prevent Samba app from getting exclusive access

This complicates enormous :-( -- lets see how far i get.

best regards
Rolf

Ash

unread,
Jan 20, 2018, 7:17:07 AM1/20/18
to Harbour Users
... and sysdata.dbf is locked by fltn.prg.

elch

unread,
Jan 20, 2018, 12:59:47 PM1/20/18
to Harbour Users
Hello Ash,

and from within chroot jail.
root@bmsprod:/# smbstatus -L
No locked files
because Samba runs not in 'jail' -- this is for /volume1,
and that outside users cannot access root: /

We mount a Samba share in /mnt/samba,
and this is mounted! with 'bind' in the 'jail' -- this adds an unnecessary level of re-direction.
In my post of 15.12 with attach 'letodb.sh' was a description to ease that.
But its not the root of problems.

-----
for our terminology, we have two *groups* of socks:
<shared> with F/R-locks
<exclusive> opened table

The members of the <shared> group respect other members in their! group,
co-work with F-R-lock() was fine before newly changes in LetoDBf.
Just ready implemented logics make the <exclusive> group members respect themself!
[ short info about in ChangeLog.txt -- changes only for the lib ]

* Problem is the respect of member of one versus members of the other group *
Two 'holes' remain:
# Win Samba app <exclusive> open table --> LetoDBf app can open it <shared>
# LetoDBf <exclusive> open table --> Win Samba app can open it <shared>

What works:
# no side can open <exclusive>, if the other side have opend at least <shared> ?

This is the result of a *not set* <DENY_ALL>
from LetoDBf/ Harbour for the mounted Samba share in Linux!
Harbour ever set a <DENY_NONE> == shared usage.
Watch it with: smbstatus
If this wouldn't be, we would have a perfect solution.
* I do not know a direct workaround for that, EOT *


[ ..
What i suggested as #1b can now also be done as #1c.
*Problem* : both sides (Leto RDD/ Samba app ) have to follow this rule,
and won't act alike 'by definition' -- its just a convention.

# create a new DBF called 'smb_ctrl", one field is enough, need no records:
{{"ELCH","L",1,0}}
# (try to) open it exclusive
Only on success [no NetErr()] proceed with action on shared tables.

This 'smb_ctrl' will give you a 'common hook',
the query for it can be encapsulated in a tiny function.
FLock() --> FLock() .and. smb-ctrl( lOpenClose )
You may use multiple of such 'hooks' for better granulation for specific areas
in your software.

Possible, but somehow 'ugly', isn't it ?
.. ]


#####

I like to do some tests with NFS -- proposed to be faster as Samba.
Install at Linux side is a child-play.
* The pain is at Windows side *,
and comes out of times M$ was massive bullying against Unix/ Linux.

And they still do bullying:
NFS service not included in <professional> :-)) edition of Win7 ff,
only in "enterprise" 8-)! and ultimate edition.
Created decades ago, nearly any Unix can do it.

Waiting on a OEM DVD with 'extended' (laughter!) Win7,
hopefully arrives mid next week.

best regards
Rolf

Ash

unread,
Jan 20, 2018, 5:14:11 PM1/20/18
to Harbour Users
Hello Rolf,

It appears that LetoDBf and Samba are not aware of each other's EXCLUSIVE USE of a table. This could be because LetoDBf is running in chroot jail. However, both environments appear to be aware of each other's record and file locks. My application appears to behave in the same manner as it did before the introduction of port 2814.

Regards.
Ash

elch

unread,
Jan 21, 2018, 8:24:13 AM1/21/18
to Harbour Users
Hello Ash,


My application appears to behave in the same manner as it did before the introduction of port 2814. 
# no side can open <exclusive>, if the other side have opend at least <shared> ?

this 'seem' to make a difference for me, please check at your place.

best regards
Rolf

elch

unread,
Jan 21, 2018, 9:10:37 AM1/21/18
to Harbour Users
addendum, Ash

if i think about ...
both LetoDBf must not run in chroot ( then started via shown init-script ),
where DataPath == LetoDBf 'chroot' alike,
[ sure that 'should' not be "/" -> lost ;-) ]

BTW,
have never! tested in a chroot environment, left this for you ...

best regards
Rolf

Ash

unread,
Jan 21, 2018, 9:53:28 AM1/21/18
to Harbour Users
Hello Rolf,

I was thinking the same.

chroot no longer in use.  
Port 2814 no longer in use.

I have now run LetoDBf in the same environment as Samba and find the same behaviour - LetoDBf and Samba can open the same table in EXCLUSIVE mode at the same time. 

01.21.2018 09:24:23       LetoDBf Server try to start ...
01.21.2018 09:24:23       UDF file: /usr/local/bin/letoudf.hrb not present.
01.21.2018 09:24:23 INFO: LetoDBf Server 3.00, will run at port :2812 ( internal also used :2813 )
01.21.2018 09:24:23 INFO: DataPath=/volume1/bms/comp, ShareTables=1, NoSaveWA=1, max database=999
01.21.2018 09:24:23 INFO: LoginPassword=0, CacheRecords=30, LockExtended=0

I have started LetoDBf manually. How do I start it at startup?

Regards.
Ash

elch

unread,
Jan 21, 2018, 10:18:27 AM1/21/18
to Harbour Users
Hello Ash,

as i dont know, what else services run in chroot, may leave that running.
And we can use that startup script ...
... else this was based on a found report from Synology:

-----
#letodb.ini
DataPath = /volume1/bms/comp
[ you already did ]


# unknown name of that script
chroot ${CHROOTTARGET}/ /usr/local/bin/letodb start
-->
/usr/local/bin/letodb config letodb
/usr/local/bin/letodb config letosmb


chroot ${CHROOTTARGET}/ /usr/local/bin/letodb stop
that really works, aka you get a line in letodbf.log: ?
Server at port 2812 have shutdown

then:
-->
/usr/local/bin/letodb stop letodb
/usr/local/bin/letodb stop letosmb


----
Port 2814 no longer in use.

... the same behaviour - LetoDBf and Samba can open the same table in EXCLUSIVE mode at the same time. 
Confirmed! - so it was ...

... and now leto elch run *with* using :2814: ??

best regards
Rolf

Ash

unread,
Jan 21, 2018, 4:10:45 PM1/21/18
to Harbour Users
Hello Rolf,

I have removed chroot because it simplifies the setup for both development and production environments. I have been testing this change this morning and find that it works just the way the old one did. My application works correctly either in LetoDBf or Samba environment for record and file locks as well as exclusive use of a tables. However, I am still not able to exclusively use a table between LetoDBf and Samba.

Current setup

Windows:

Samba share is mapped as z:\ in Windows 10 Pro workstation.

NAS:

/etc contains both letodb.ini and letosmb.ini. Both are the same except for the port #.

;letodb.ini
[Main]
DataPath = /volume1/bms/comp
LogPath = /var/log/letodb         
EnableFileFunc = 1
EnableUDF = 1 
Cache_Records = 30
TimeOut = -1
No_Save_WA = 1
Share_Tables = 1

;letobms.ini
[Main]
DataPath = /volume1/bms/comp
LogPath = /var/log/letodb         
EnableFileFunc = 1
EnableUDF = 1 
Cache_Records = 30
;Debug = 10
TimeOut = -1
No_Save_WA = 1
Share_Tables = 1

/usr/local/etc/rc.d has letodb.sh. It is slightly modified to start letodb as well.

#! /bin/sh

case "$1" in
  start)
    echo "Starting LetoDBf for exclusive access"
    /usr/local/bin/letodb start
    /usr/local/bin/letodb config letosmb
    ;;
  stop)
    echo "Stopping LetoDBf for exclusive access"
    /usr/local/bin/letodb stop
    /usr/local/bin/letodb stop letosmb
    ;;
  *)
    echo "Usage: /usr/local/etc/init.d/letodb {start|stop}"
    exit 1
    ;;
esac

exit 0

Libraries, server and client programs are compiled with the following defines:

-cflag="-DLETO_SMBSERVER=bmsprod"
-cflag="-DLETO_SMBPORT=2814"

Snippets used for exclusive use test.

// hbmk2 fltn.prg rddleto.hbc -ie:\letodbf\include

REQUEST DBFCDX, LETO

PROCEDURE main( )

   rddSetDefault( "DBFCDX" )

   USE z:\comp\sysdata NEW
   IF NetErr()
      ? 'Cannot open file.'
      inkey(0)
   ELSE
      browse()
   ENDIF

RETURN

// hbmk2 flt.prg rddleto.hbc -ie:\letodbf\include

#include "rddleto.ch"

REQUEST LETO, DBFCDX

PROCEDURE main( )

   rddSetDefault( "LETO" )

   IF leto_Connect( "//bmsprod:2814/" ) < 0
      hb_Alert( 'No 2814.' )
      QUIT
   ENDIF

   IF leto_Connect( "//bmsprod:2812/" ) < 0
      hb_Alert( 'No 2812.' )
      QUIT
   ENDIF

   USE sysdata NEW
   IF NetErr()
      ? 'Cannot open file.'
      inkey(0)
   ELSE
      browse()
   ENDIF


RETURN

I think this change removes any complications as a result of using chroot. Please let me know if I have misunderstood your instructions.

Regards.
Ash

Ash

unread,
Jan 21, 2018, 4:14:05 PM1/21/18
to Harbour Users
Sorry, bad cust and paste.

;letosmb.ini
[Main]
DataPath = /volume1/bms/comp
Port = 2814
LogPath = /var/log/letodb         
EnableFileFunc = 1
EnableUDF = 1 
Cache_Records = 30
TimeOut = -1
No_Save_WA = 1
Share_Tables = 1


Message has been deleted

Ash

unread,
Jan 21, 2018, 4:38:57 PM1/21/18
to Harbour Users
Hello Rolf,

/etc/fstab contains the following 3 lines.

none /proc proc defaults 0 0
/dev/root / ext4 defaults 1 1
/dev/vg1000/lv /volume1 ext4 usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0,synoacl,relatime 0 0

Regards.
Ash


On Sunday, January 21, 2018 at 4:23:54 PM UTC-5, elch wrote:
Hello Ash,


why did you change this:

;letobms.ini
[Main]
this line not needed  

DataPath = /volume1/bms/comp
/mnt/samba/comp
!!!

Our entry in /etc/fstab is still there !! ?

best regards
Rolf
Message has been deleted

Ash

unread,
Jan 21, 2018, 5:09:49 PM1/21/18
to Harbour Users
Hello Rolf,

I added the following line to \etc\fstab file and restarted the NAS.

mount -o bind /volume1/bms /mnt/samba

Get an error on restart.

01.21.2018 17:00:33       LetoDBf Server try to start ...
01.21.2018 17:00:33       UDF file: /usr/local/bin/letoudf.hrb not present.
01.21.2018 17:00:33 INFO: LetoDBf Server 3.00, will run at port :2812 ( internal also used :2813 )
01.21.2018 17:00:33 INFO: DataPath=/volume1/bms/comp, ShareTables=1, NoSaveWA=1, max database=999
01.21.2018 17:00:33 INFO: LoginPassword=0, CacheRecords=30, LockExtended=0
01.21.2018 17:00:33       LetoDBf Server: DataPath '/mnt/samba/comp' does not exists ..

But when I look into /etc/fstab, the 'mount' line is missing. Tried it twice.

Regards.
A
On Sunday, January 21, 2018 at 4:44:02 PM UTC-5, elch wrote:
Hello Ash,

we had all fine setup-ed, with an entry to mount samba in /etc/fstab in /mnt/samba,
correct letosmb.ini ....

:-(

best regards
Rolf
It is loading more messages.
0 new messages