Bug 15493 - Failed to open excel file in Windows previous versions
Summary: Failed to open excel file in Windows previous versions
Status: RESOLVED DUPLICATE of bug 13688
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: 4.15.13
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-11 02:07 UTC by Mike Liu
Modified: 2024-01-03 11:37 UTC (History)
0 users

See Also:


Attachments
strace log (163.09 KB, image/png)
2023-10-11 02:07 UTC, Mike Liu
no flags Details
windows_previous_version_open_excel_file (65.15 KB, image/png)
2023-10-11 06:49 UTC, Mike Liu
no flags Details
sniffer (57.60 KB, application/octet-stream)
2023-10-11 06:49 UTC, Mike Liu
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Liu 2023-10-11 02:07:52 UTC
Created attachment 18153 [details]
strace log

Can not open the excel file in Windows previous versions.

Windows Execl sends create request with access mask 0x0012019f (contain Write/Append/Write EA/ Write Attribute),
Samba server returns STATUS_MEDIA_WRITE_PROTECTED because openat() return EROFS.
Comment 1 Volker Lendecke 2023-10-11 05:53:24 UTC
Isn't MEDIA_WRITE_PROTECTED exactly the right error message? I'm not sure that it's expected to directly open snapshot files with Excel. How does that work in Windows? Whenever I test this, I only expect the "restore" operation to work.
Comment 2 Mike Liu 2023-10-11 06:49:40 UTC
Created attachment 18154 [details]
windows_previous_version_open_excel_file

Network packet shows ...
1. It works well if Excel opens file with read access.
2. Excel shows 'Sorry We Couldn't Open ...' when it send create request with write access.

And this issue did not happen in Samba-4.13

---

> Whenever I test this, I only expect the "restore" operation to work.

Yes. 'Restore' still works fine.
Comment 3 Mike Liu 2023-10-11 06:49:57 UTC
Created attachment 18155 [details]
sniffer
Comment 4 Volker Lendecke 2023-10-11 09:38:51 UTC
(In reply to Mike Liu from comment #2)
> And this issue did not happen in Samba-4.13

... and I would argue that this is potentially a bug in Samba 4.13 that was silently fixed. What do others think? Should Samba silently swallow the O_RDWR bits in the open request?

Does your file system have writable snapshots that don't work anymore now?
Comment 5 Mike Liu 2023-10-11 09:50:39 UTC
> ... and I would argue that this is potentially a bug in Samba 4.13 that was silently fixed. 
> What do others think? Should Samba silently swallow the O_RDWR bits in the open request?

I think previous samba work around it.

	/*
	 * Just pave over the user requested mode and use O_RDONLY. Later
	 * attempts by the client to write on the handle will fail in the
	 * pwrite() syscall with EINVAL which we carefully map to EROFS. In sum,
	 * this matches Windows behaviour.
	 */
	how.flags &= ~(O_WRONLY | O_RDWR | O_CREAT);

> Does your file system have writable snapshots that don't work anymore now?
No. We use read-only (mount ro) for snapshots.
Comment 6 Ralph Böhme 2024-01-03 11:37:39 UTC

*** This bug has been marked as a duplicate of bug 13688 ***