Comments (8)
It seems we should do
diff --git a/src/path.rs b/src/path.rs
index 92ecefd1a..97a1b8ff8 100644
--- a/src/path.rs
+++ b/src/path.rs
@@ -660,7 +660,7 @@ fn path_remoteness(path: &wstr) -> DirRemoteness {
=> DirRemoteness::remote,
_ => {
// Other FSes are assumed local.
- DirRemoteness::local
+ DirRemoteness::unknown
}
}
}
We'll still use flock for unknown remoteness but won't mmap the file.
We can still return DirRemoteness::local for some most file systems.
Or maybe we can check if mmap fails somehow.. I guess no.
from fish-shell.
Um, I think I know where the problem lies now. This switch-case:
Line 120 in 80394ea
does not correctly handle my storage type, which leads to subsequent use of mmap. Our storage returns a special f_type, which is not included in the enumerated data.
from fish-shell.
great work, can you share the file type magic number? Or the relevant line from /proc/mounts
?
Perhaps we can find a better approach.
Does df -l path/to/your/file
work? Their heuristic is here: https://github.com/coreutils/gnulib/blob/master/lib/mountlist.c#L232-L236
from fish-shell.
great work, can you share the file type magic number? Or the relevant line from
/proc/mounts
? Perhaps we can find a better approach. Doesdf -l path/to/your/file
work? Their heuristic is here: https://github.com/coreutils/gnulib/blob/master/lib/mountlist.c#L232-L236
The type of the magic num is fea36969
, which is extracted by:
#include <iostream>
#include <sys/statfs.h>
int main() {
const char* path = "/mnt/hwfile/";
struct statfs fs_info;
statfs(path, &fs_info);
unsigned int fs = static_cast<unsigned int>(fs_info.f_type);
std::cout << std::hex << fs << std::endl;
return 0;
}
The result of df -lh path/to/your/file
is:
Filesystem Size Used Avail Use% Mounted on
/hwfile01 850T 755T 96T 89% /mnt/hwfile
Hmm, it seems quite challenging to differentiate remote file systems through simple operations, as various providers' file systems don't adhere to strict standards (perhaps innovation?). I think it would be simpler if Fish could offer a toggle to control whether to enable mmap, or allow users to configure whether it belongs to a remote FS.
from fish-shell.
But still, if there are meaningful difference between remote and local filesystems, I don't think applications should be required to list all possible local filesystems.
I'm not sure if we want to stop using mmap.
(I'm also not sure what's the problem with using it on NFS.)
Maybe we can detect that mmap is failing and then fall back to reading the file?
How does the problem manifest for you? Any reproducer? If mmap
returns MAP_FAILED
, we could simply do
diff --git a/src/history/file.rs b/src/history/file.rs
index 489bc83cc..f63783277 100644
--- a/src/history/file.rs
+++ b/src/history/file.rs
@@ -121,7 +121,7 @@ impl HistoryFileContents {
let len: usize = file.seek(SeekFrom::End(0)).ok()?.try_into().ok()?;
let mmap_file_directly = should_mmap();
let mut region = if mmap_file_directly {
- MmapRegion::map_file(file.as_raw_fd(), len)
+ MmapRegion::map_file(file.as_raw_fd(), len).or_else(|| MmapRegion::map_anon(len))
} else {
MmapRegion::map_anon(len)
}?;
I don't know how else it could fail, you don't get garbage data, right?
from fish-shell.
Related Issues (20)
- Key input after piping to `fzf` does not work with new extended keyboard input functionality HOT 3
- Focus reporting stays on in long-running loop
- Commandline is needlessly repainted with new extended keyboard input functionality HOT 4
- Multiple successive up-or-search broken in gnome terminal HOT 3
- Autosuggestions suggest non-existing files HOT 10
- mipsel arch lacks AtomicU64 support HOT 5
- Suppress wildcards-globbing for http(s) parameters HOT 1
- Can't use Windows Terminal's Starting Directory HOT 4
- document limitations of --condition HOT 4
- Request to add support for piping into `fish -c 'builtin'` for built-ins HOT 3
- Inconsistanc behavior when changing a symlinked folder in the current working directory HOT 1
- [Suggestion] Do not include final slash on path completion for symlinks to directories HOT 2
- `commandline` seems to lose line break characters HOT 2
- consider making `history-prefix-search-backward` and forward don't change cursor position HOT 1
- [Feature] [vi-mode] Support command count HOT 2
- cd fails for directory without read permission, displays `Permission denied` HOT 4
- WARNING: 'envvar' reference target not found when running 'sphinx-build' to build docs HOT 3
- Using `read` in script cause panic
- Parse and even freeze issue on pasting large input HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fish-shell.