You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With some file systems, for example SFTP mounted via GVFS, you can only open a file in Read Only mode, because the detection, if a file is writeable, doesn't work.
The reason is, in this case, the file system doesn't support opening a file in read/write mode, so something like open(path, O_O_RDWR) will fail with EOPNOTSUPP. However, opening the file in write only mode works, so the file is definitely writeable.
The responsible code in nedit-ng is in DocumentWidget.cpp in the DocumentWidget::doOpen method:
// detect if the file is readable, but not writable
QFile file(fullname);
if (file.open(QIODevice::ReadWrite) || file.open(QIODevice::ReadOnly)) {
info_->lockReasons.setPermLocked(!file.isWritable());
}
The first file.open() will fail here.
A possible solution would be, to just check if the file can be opened as WriteOnly.
// detect if the file is writable
QFile file(fullname);
if (!file.open(QIODevice::WriteOnly | QIODevice::Append)) {
info_->lockReasons.setPermLocked(true);
}
Interestingly this is a regression, that I also had in xnedit. The original nedit is not affected, because the file is only opened in read mode, and write permissions are checked with access():
With some file systems, for example SFTP mounted via GVFS, you can only open a file in Read Only mode, because the detection, if a file is writeable, doesn't work.
The reason is, in this case, the file system doesn't support opening a file in read/write mode, so something like
open(path, O_O_RDWR)
will fail withEOPNOTSUPP
. However, opening the file in write only mode works, so the file is definitely writeable.The responsible code in nedit-ng is in DocumentWidget.cpp in the
DocumentWidget::doOpen
method:The first
file.open()
will fail here.A possible solution would be, to just check if the file can be opened as
WriteOnly
.Interestingly this is a regression, that I also had in xnedit. The original nedit is not affected, because the file is only opened in read mode, and write permissions are checked with
access()
:The text was updated successfully, but these errors were encountered: