Comments (12)
Eric Mertens [email protected] writes:
This is by design, all that this module does it make it possible to open an FD with a
RawFilePath
which is a bytestring because POSIX doesn't specify any particular encoding for filenames.It perhaps wouldn't be a terrible idea to add a note in the Haddocks
mentioning this.
from unix.
I came across this just now and found it baffling too. I was expecting fdRead, fdWrite, et al, to operate on ByteString
s. I could convert my Fd
s to Handle
s but in some applications I specifically want to ultimately use POSIX calls rather than whatever System.IO
decides to use (presumably C stdio for portability?)
from unix.
This is by design, all that this module does it make it possible to open an FD with a RawFilePath
which is a bytestring because POSIX doesn't specify any particular encoding for filenames.
Are you proposing to change the purpose of this module?
from unix.
More like I was digging into how I'd do posix pipes manipulation and was
suprised. Granted I think bytestring has the ops I need. Just wanted to
ask in a documented way the answer could be reused next time.
That makes sense. Thanks !
On Wednesday, June 1, 2016, Eric Mertens [email protected] wrote:
This is by design, all that this module does it make it possible to open
an FD with a RawFilePath which is a bytestring because POSIX doesn't
specify any particular encoding for filenames.Are you proposing to change the purpose of this module?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#63 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAAQwgWsU8iwlVk37GjzYYYnx4chyvm1ks5qHbZ7gaJpZM4IrkOE
.
from unix.
Agreed. That's probably a good idea. Better than staying maintainer
folklore. Does the same rule of thin apply to the other .Bytestring
modules?
On Wednesday, June 1, 2016, Ben Gamari [email protected] wrote:
Eric Mertens <[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');> writes:This is by design, all that this module does it make it possible to open
an FD with aRawFilePath
which is a bytestring because POSIX doesn't
specify any particular encoding for filenames.It perhaps wouldn't be a terrible idea to add a note in the Haddocks
mentioning this.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#63 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAAQwsw-XaDDYw4bqO6BN6_679kpytWTks5qHfGDgaJpZM4IrkOE
.
from unix.
@cartazio see top of http://hackage.haskell.org/package/unix-2.7.2.0/docs/System-Posix-ByteString.html
POSIX.1-2008 support with ByteString file paths and environment strings.
This module exports exactly the same API as System.Posix, except that all file paths and environment strings are represented by ByteString instead of String. The System.Posix API implicitly translates all file paths and environment strings using the locale encoding, whereas this version of the API does no encoding or decoding and works directly in terms of raw bytes.
It perhaps wouldn't be a terrible idea to add a note in the Haddocks mentioning this.
do we really have to replicate that paragraph in each and every .ByteString
-module?
finally, shameless self-plug: with AFPP we wouldn't need the .ByteString
API-duplication anymore :-)
from unix.
My opinion is that ByteString variants shouldn't mess with CString
at all (that means convert to ByteString
, ShortByteString
or something else that's a no-op).
Whether that's a filepath or not doesn't really matter, does it? Most CString
s don't have any pre-defined encoding.
from unix.
Essentially anything working through peekCString*
/ pokeCString*
should not be present under System.Posix.ByteString
tree, because it involves locale-dependent encoding/decoding, but raison d'etre of System.Posix.ByteString
is to be locale-independent.
from unix.
One of the bigger problems seems to be GroupEntry
and UserEntry
.
What to do here? Parametrize the type? Add a new type? I think the String
type here can in fact lead to security vulnerabilities.
from unix.
What does POSIX say about username / groupname? Is it just a bytestring with no encoding associated? Or is it supposed to be ASCII subset only?
from unix.
- https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pwd.h.html
- https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpwuid.html
I can't see any mention of encoding. It seems it's only implicit that these are NUL terminated. No other guarantees.
from unix.
I think most of these instances are fixed. Some boring ones involving error types are still there, but not very interesting. I'll open a new ticket for GroupEntry/UserEntry.
from unix.
Related Issues (20)
- Remove config.sub
- Revitalise System.Posix.DynamicLinker.Module
- Consider paring down the set of output modes HOT 7
- Include GHC 9.4 in CI ? HOT 4
- System library dependencies not documented HOT 3
- Build error with wasm32-wasi: system `wasi' not recognized HOT 11
- `unix-2.8` release for GHC 9.6 HOT 4
- `System.Posix.Env.ByteString.getEnvironment` segfaults on empty environment HOT 5
- NetBSD CI broken HOT 1
- System.Posix.User stopped exporting UserEntry HOT 3
- Should `mkstemp` use `throwErrnoIfMinus1Retry` instead of `throwErrnoIfMinus1`? HOT 3
- Add CI for the JS backend
- getAllGroupEntries fail on rhel8 HOT 23
- Memory unsafety in `withFilePath` in 2.8.2.0 HOT 6
- 2.8.3.0 fails to build on Linux 6.1.62 / glibc 2.35 HOT 2
- Release 2.8.4.0 HOT 10
- waitToSetLock can block but is an unsafe FFI import HOT 6
- Please revise time dependency to < 1.15 HOT 4
- CI: caching is likely broken HOT 3
- Add portable support for file open with data caching supressed/eliminated. HOT 6
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 unix.