Opened 4 years ago

Last modified 4 years ago

#279 assigned defect

Saving a file with MED editor on an SMB2+ share causes the file size to be set to 0

Reported by: Paul Smedley Owned by: Paul Smedley
Priority: critical Milestone:
Component: Samba Client Version: Client 3.0.x
Keywords: Cc: Lewis Rosenthal


There is a major issue with saving files with the MED editor on a SMB2+ share. After saving a file, the file size is 0 and the file is destroyed.

Change History (3)

comment:1 Changed 4 years ago by Paul Smedley

Logs show: 2016/12/21 17:30:05.48: 4 4: cli_setnewfilesize(\readme.txt) 1832 2016/12/21 17:30:05.48: 4 4: cli_setnewfileszie : cli_open(\readme.txt) attr 00000000 mode 501 denymode 02 2016/12/21 17:30:05.49: 9 4: NdpFileNewSizeL <\readme.txt> 1832 0

note the reference to cli_open() does NOT occur with a SMB1 share.

It seems cli_ftruncate() is failing on a SMB2+ share (reasons unclear). When it fails, ndpsmb is re-opening the file, and overwriting it. I'm really not clear what the purpose of re-opening the file in smbwrp_setfilesize() is. I'm open to input, but for now, in the event of a failure of cli_ftruncate(), I'm just returning the rc, rather than re-opening the file.

I haven't yet committed this to the client-3.0 branch until I do some further testing, but there is an updated build of the 3.0 plugin at

comment:2 Changed 4 years ago by Paul Smedley

Owner: set to Paul Smedley
Status: newassigned

comment:3 Changed 4 years ago by Paul Smedley

FYI - cli_ftruncate issue is confirmed as an upstream bug -

I still believe the cli_open() when cli_ftruncate fails is bogus and destructive.

Note: See TracTickets for help on using tickets.