Skip to content

Commit 9c85a5f

Browse files
committed
More documentation for pax_global_header
1 parent 0faa59b commit 9c85a5f

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

Codec/Archive/Tar/Check/Internal.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,11 @@ showFileNameError mb_plat err = case err of
146146
checkTarbomb :: FilePath -> CheckSecurityCallback
147147
checkTarbomb expectedTopDir entry = do
148148
case entryContent entry of
149-
OtherEntryType 'g' _ _ -> pure () --PAX global header
150-
OtherEntryType 'x' _ _ -> pure () --PAX individual header
149+
-- Global extended header aka XGLTYPE aka pax_global_header
150+
-- https://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13_02
151+
OtherEntryType 'g' _ _ -> pure ()
152+
-- Extended header referring to the next file in the archive aka XHDTYPE
153+
OtherEntryType 'x' _ _ -> pure ()
151154
_ ->
152155
case FilePath.Posix.splitDirectories (entryTarPath entry) of
153156
(topDir:_) | topDir == expectedTopDir -> pure ()

htar/htar.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ import System.Console.GetOpt (OptDescr(..), ArgDescr(..), ArgOrder(..),
1616
import System.Environment (getArgs)
1717
import System.Exit (exitFailure)
1818
import System.IO (hPutStrLn, stderr)
19-
import Data.Time (formatTime)
19+
import Data.Time (formatTime, defaultTimeLocale)
2020
import Data.Time.Clock.POSIX (posixSecondsToUTCTime)
21-
import Data.Time (defaultTimeLocale)
2221

2322
main :: IO ()
2423
main = do
@@ -206,12 +205,12 @@ parseOptions :: [String] -> IO (Options, [FilePath])
206205
parseOptions args =
207206
let (fs, files, nonopts, errors) = getOpt' Permute optDescr args
208207
in case (nonopts, errors) of
209-
([], []) -> return $ (foldl (flip ($)) defaultOptions fs, files)
210-
(_ , (_:_)) -> die errors
211-
(_ , _) -> die (map (("unrecognized option "++).show) nonopts)
208+
([], []) -> return (foldl (flip ($)) defaultOptions fs, files)
209+
(_ , _ : _) -> die errors
210+
(_ , _) -> die (map (("unrecognized option "++).show) nonopts)
212211

213212
die :: [String] -> IO a
214213
die errs = do
215-
mapM_ (\e -> hPutStrLn stderr $ "htar: " ++ e) $ errs
214+
mapM_ (\e -> hPutStrLn stderr $ "htar: " ++ e) errs
216215
hPutStrLn stderr "Try `htar --help' for more information."
217216
exitFailure

0 commit comments

Comments
 (0)