Support `OsString`

Aperta
#252 8 commenti 6 reazioni 0 assegnatari Vedi su GitHub

@mmhat ci sta già lavorando.

Dal 9/10/2026.

  • #383 di @mmhat — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
haskell

Direzione di ricerca

Inizia esaminando la documentazione di System.OsPath e le API di migrazione filepath, unix e Win32 referenziate, quindi traccia il modo in cui process gestisce i percorsi su ciascuna piattaforma. Il lavoro è completato quando process supporta OsString in modo coerente su tutte le piattaforme supportate, dopo che tali dipendenze sono state aggiornate e sincronizzate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Motivation

The next filepath release will add support for a new API, which fixes subtle encoding issues and improves cross platform code and memory residence.

You can read about the state of the newly added API here: https://github.com/haskellfoundation/tech-proposals/issues/35

Release is here: https://hackage.haskell.org/package/filepath-1.4.100.0

Demonstration about unsoundness of base with exotic encodings and how the new API fixes them is here: https://gist.github.com/hasufell/c600d318bdbe010a7841cc351c835f92

Migrations

Migrations can happen once the filepath, unix and Win32 packages are updated and in sync. A migration would usually involve using the new types from System.OsPath and the new API variants from unix/Win32.

When writing low-level cross platform code manually (shouldn't generally be necessary), the usual strategy is this:

#if defined(mingw32_HOST_OS) || defined(__MINGW32__)
import qualified System.OsPath.Data.ByteString.Short.Word16 as SBS
import qualified System.OsPath.Windows as PFP
#else
import qualified System.OsPath.Data.ByteString.Short as SBS
import qualified System.OsPath.Posix as PFP
#endif

crossPlatformFunction :: OsPath -> IO ()
#if defined(mingw32_HOST_OS) || defined(__MINGW32__)
crossPlatformFunction (OsString pfp@(WS ba)) = do
    -- use filepath functions for windows specific operating system strings
    let ext = PFP.takeExtension pfp
    -- operate directly on the underlying bytestring (which is a wide character bytestring, so uses Word16)
    let foo = SBS.takeWhile
    ...
#else
crossPlatformFunction (OsString pfp@(PS ba)) = do
    -- use filepath functions for posix specific operating system strings
    let ext = PFP.takeExtension pfp
    -- operate directly on the underlying bytestring (which is just Word8 bytestring)
    let foo = SBS.takeWhile
    ...
#endif

Platform specific code can be written using PosixPath/WindowsPath types.

If you have further questions, please let me know. I'm going to write a blog post outlining the affairs and more in-depth intro and migration strategies close after the release. This is a heads up.

Lingua principale
Haskell
Stelle
91
Fork
93
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di haskell/process

Tutte le issue di haskell/process

Issue simili

Altre issue su Haskell

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.