Compare commits

..

1818 Commits

Author SHA1 Message Date
7daf199610
Merge remote-tracking branch 'origin/pr/1048' 2024-04-27 16:09:04 +08:00
David Binder
23c185e3e0 Fix user guide w.r.t. ghcjs cross bindist installs
Installing a ghcjs bindist might require to install
a specific version of emscripten, and not the latest.
2024-04-24 02:02:17 +02:00
682e0e94f7
Clean up docs warnings 2024-04-23 20:12:20 +08:00
814f0cd184
Fix CSS 2024-04-23 20:07:22 +08:00
15a8137c99
Merge branch 'issue-1040' 2024-04-23 19:42:11 +08:00
7d662bb020
Document how to use GHCup's msys2 with stack, fixes #1040 2024-04-23 19:40:56 +08:00
df6205c482
Merge remote-tracking branch 'origin/pr/1041' 2024-04-22 23:09:17 +08:00
7a9d897c14
Hackage package 2024-04-22 19:27:32 +08:00
183498df7e
Extend information about transition period 2024-04-22 19:23:28 +08:00
53695fbb11
Add section about project ownership and emergency procedures 2024-04-22 19:01:09 +08:00
Artem Pelenitsyn
ca10f8ce62
!fixup 2024-04-21 21:40:52 -04:00
Artem Pelenitsyn
978c6d2704
Update guide.md: use the latest prelease channel version in the example
Plus a tiny bit of copy editing.
2024-04-21 21:37:27 -04:00
eebbc9908b
Merge branch 'issue-1036' 2024-04-07 21:40:09 +08:00
b37ac53aaf
Fix windows process creation handling wrt #1036 2024-04-07 18:07:01 +08:00
be4a1bdf7a
Update submodule 2024-03-31 22:09:42 +08:00
7cad0ca9fe
Merge branch 'issue-1032' 2024-03-31 22:09:07 +08:00
bd6ac3068b
Use ld.gold on armv7 2024-03-31 20:30:37 +08:00
1e634131ca
Revert to old GHCs for armv7 2024-03-31 19:36:59 +08:00
87c61def9b
Fix missing C++ toolchain 2024-03-31 19:04:49 +08:00
11a3bd3e1b
Force ld.gold for armv7 2024-03-31 18:31:01 +08:00
243b200fb8
Add defGHCConfOptions option 2024-03-31 18:23:30 +08:00
700cf74001
Fix linux cross CI 2024-03-23 16:11:09 +08:00
95ac5c8fc6
Use deb 11 2024-03-23 15:18:56 +08:00
68225c1933
Update metadata submodule 2024-03-23 14:37:30 +08:00
1e0843d2ce
Update cross images 2024-03-23 14:24:38 +08:00
b853443c9e
Update cross CI 2024-03-23 13:47:34 +08:00
7a684add89
Pass --disable-ld-override when installing/compiling GHC
Fixes #1032

Users can still run 'ghcup install ghc <ver> -- enable-ld-override'
2024-03-23 13:47:33 +08:00
63e714d1b1
Merge branch 'stack-ci' 2024-03-16 18:50:20 +08:00
3675c6b16c
Add contribution section to docs 2024-03-16 18:46:38 +08:00
7f8bb14112
Document cabal.project files etc. 2024-03-16 18:27:12 +08:00
a4290909b4
Use platform specific project files 2024-03-16 18:11:39 +08:00
36fb39553d
Fix refreeze 2024-03-16 17:32:38 +08:00
18abdbf2d9
Fix cabal.project for windows 2024-03-16 17:16:29 +08:00
89ac09bbe1
Add cabal.project workflow 2024-03-16 16:38:48 +08:00
65bf155326
Add stack.yaml workflow 2024-03-16 16:38:47 +08:00
6801bf9d88
Fix 'stack build', fixes #1026 2024-03-16 16:14:39 +08:00
456200e747
Update CHANGELOG 2024-03-13 21:14:14 +08:00
09e199a176
Bump bootstrap script to 0.1.22.0 2024-03-13 20:54:23 +08:00
2ecc61ad92
Disable system-libyaml for release builds 2024-03-13 18:47:10 +08:00
dd8b23ff86
Force maerwald runners 2024-03-13 18:34:29 +08:00
d78e7af80c
Update changelog 2024-03-13 16:22:34 +08:00
cf8ed4211b
Merge branch 'checkout-4' 2024-03-13 12:05:44 +08:00
39931d98b9
Bump checkout action to 4 2024-03-13 10:34:46 +08:00
ac18c044e1
Merge branch 'cross-wasm-commits' 2024-03-11 21:45:18 +08:00
e5c941b4d7
Merge branch 'issue-1019' 2024-03-11 21:44:49 +08:00
065b307d60
Fix cabal.project.release 2024-03-11 17:59:45 +08:00
5eaae9916d
Allow to remove all unset versions, fixes #1019 2024-03-11 17:42:26 +08:00
5d0a7b71a2
Merge branch 'issue-1016' 2024-03-11 17:34:21 +08:00
b4600b8183
Merge branch 'issue-1013' 2024-03-11 17:33:28 +08:00
f465243fc6
Merge branch 'bzlib-cve' 2024-03-11 17:32:29 +08:00
e4b0e8debf
Use fixed bzlib 2024-03-11 17:31:57 +08:00
d9d13dda5f
Fix crash in 'ghcup tui' on windows
* https://github.com/haskell/ghcup-hs/issues/1013
* https://github.com/jtdaugherty/brick/issues/502#issuecomment-1974980299
* 4c395182cb
2024-03-03 14:44:20 +08:00
aef10a699e
Add viPreInstall wrt #1016 2024-03-02 17:44:40 +08:00
b413ade4db
Update docs for ghc-wasm-meta 2024-03-02 13:01:28 +08:00
190d308ddf
Bump ghcup to 0.1.22.0 2024-03-01 22:33:58 +08:00
4314146247
Merge remote-tracking branch 'origin/issue-1004' 2024-03-01 22:15:13 +08:00
4831798c9e
Merge branch 'issue-982' 2024-02-21 16:50:24 +08:00
e999e6f5b8
Merge branch 'refreezeee' 2024-02-21 16:27:36 +08:00
3ad785c116
Refreeze, update stack.yaml, etc. 2024-02-21 15:32:35 +08:00
be3db87410
Clean up on error, fixes #1004 2024-02-18 20:07:12 +08:00
57d23c477d
Update hie.yaml 2024-02-18 19:53:46 +08:00
0ec07636fb
Merge branch 'issue-998' 2024-02-18 19:53:23 +08:00
bdd15ad6e7
Beef up --overwrite-version, fixes #998 2024-02-18 19:52:01 +08:00
96f7aa5c62
Allow to set ghcup msys2 environment
Fixes #982
2024-02-18 16:22:20 +08:00
2fdf896fbd
Begone travis 2024-02-12 23:58:51 +08:00
251c82ee9f
Begone gitlab 2024-02-12 23:58:10 +08:00
c2186bb33c
Merge branch 'issue-233' 2024-02-09 21:45:02 +08:00
1a9d43ea1a
Allow all runners 2024-02-09 21:41:34 +08:00
9de324d3c3
Merge remote-tracking branch 'origin/windows-bootstrap-fail-on-non-x86' 2024-02-09 21:40:40 +08:00
b53acfe61f
Drop enforcing clang on FreeBSD (why did we ever do that?) 2024-02-09 21:36:53 +08:00
Rune K. Svendsen
c92f71471d Windows bootstrap: fail on non-x86 2024-02-07 10:50:38 +01:00
2a79c669a5
Update release scripts 2024-02-03 00:16:18 +08:00
9b2d326c38
Merge branch 'freebsd' 2024-02-03 00:15:53 +08:00
2bfca3760c
Finalize FreeBSD CI 2024-02-02 23:05:14 +08:00
0f7f5347d8
Force x86 self hosted runners for cross 2024-02-02 16:22:24 +08:00
80703d7b29
Be more portable wrt sourcing scripts 2024-02-02 16:18:50 +08:00
942685f396
Also dump env into ~/.profile, fixes #763 2024-02-02 15:40:31 +08:00
02744ff4a0
Don't spam bashrc with commented lines 2024-02-02 15:31:32 +08:00
c74409b9a5
Remove cleanup hack on ARM64 Linux 2024-02-01 16:02:34 +08:00
1c32dbc88a
Also install libiconv on FreeBSD 2024-02-01 16:02:20 +08:00
ab17270761
Use self-hosted FreeBSD runner 2024-02-01 00:08:25 +08:00
d0538a50e0
Don't error when cleanup action fails 2024-01-30 16:32:29 +08:00
318ac21e41
Merge branch 'tui-scrolling' 2024-01-25 19:48:24 +08:00
3e9bb7c369
Restore TUI scrolling to old behavior 2024-01-22 22:39:45 +08:00
2c64cd0f02
Merge branch 'issue-981' 2024-01-22 16:04:54 +08:00
59e6b65249
Make sure .bashrc is adjusted on windows during installation
Fixes #981
2024-01-22 15:52:27 +08:00
91ef2c7666
Merge branch 'issue-983' 2024-01-22 13:51:45 +08:00
935cb5541b
Fix 'versions' version to resolver #983 2024-01-21 22:01:08 +08:00
9a7eb11c73
Merge branch 'issue-978' 2024-01-21 16:34:31 +08:00
4b338ccfd8
Fix windows ghcup test script 2024-01-21 15:29:12 +08:00
ca92b29ffe
Fix optparse tests on windows 2024-01-21 14:00:53 +08:00
ec4e69e89d
Fix indentation 2024-01-21 13:52:49 +08:00
c225f2cfee
Fix language-c on windows 2024-01-21 13:51:54 +08:00
e325728f38
Fix windows golden test 2024-01-21 13:47:03 +08:00
c9a44d211e
Update .gitignore 2024-01-20 18:24:17 +08:00
4b3ffd8570
Use file-uri for better URI handling, fixes #978 2024-01-20 18:23:08 +08:00
3e9746cf0c
Fix cabal.project.release 2024-01-20 17:58:04 +08:00
950155cbe3
Fix hlint 2024-01-20 17:50:40 +08:00
dd978ff2fd
Merge branch 'issue-967' 2024-01-20 17:48:51 +08:00
4bbaffaa6f
Update project files 2024-01-20 17:43:12 +08:00
2a12362e75
Merge branch 'issue-408' 2024-01-20 17:40:21 +08:00
411ac8dc31
Refreeze 2024-01-20 17:37:08 +08:00
b837a93176
Merge remote-tracking branch 'origin/pr/943' 2024-01-20 16:59:53 +08:00
1c56e782d2
Revert GHC bump on alpine32 wrt #962 2024-01-20 16:58:38 +08:00
c6c61ca486
Merge remote-tracking branch 'origin/update-ci2' 2024-01-20 16:56:12 +08:00
6ae312c1f9
Merge remote-tracking branch 'origin/tar' 2024-01-20 16:55:46 +08:00
f6cf4cb90c
Merge remote-tracking branch 'origin/fix-957' 2024-01-20 16:54:42 +08:00
3ff65219e8
Merge remote-tracking branch 'origin/pr/976' 2024-01-20 16:52:31 +08:00
e33f554838
Merge branch 'disable-cabal-xdg' 2024-01-20 16:48:43 +08:00
2850f343b9
Disable cabal XDG by default 2024-01-16 23:59:39 +08:00
Geoffrey Noel
8d6445c632 Assume /home/gnoel/.local/share if XDG_DATA_HOME is not set 2024-01-13 18:35:37 -05:00
Geoffrey Noel
de611e0d4e Consider STACK_XDG env to determine the stack root path 2024-01-13 15:34:14 -05:00
Rune K. Svendsen
6fec9d4737 Quote version in Pretty NotInstalled instance 2024-01-11 11:42:56 +01:00
Rune K. Svendsen
856e48aa14 Make HLint happy 2024-01-09 10:26:46 +01:00
Rune K. Svendsen
2cafd9d2bc Fix redundant import warning 2024-01-09 10:22:51 +01:00
Rune K. Svendsen
87ec8c756f Move ArchiveResult into GHCup.Utils.Tar.Types
So a module that wants to import ArchiveResult doesn't have to worry about CPP.
2024-01-09 10:19:58 +01:00
2ece023c0f
Fix coding suggestions 2024-01-07 22:03:06 +08:00
16e20ed474
Set LD=ld.bfd on Alpine linux during bindist configure 2024-01-04 20:53:21 +08:00
afd7e7dc4f
Re-introduce tar 2024-01-03 17:56:33 +08:00
d46bdbf959
Fix misinterpretation of '+' in URI paths, fixes #408 2024-01-03 00:42:01 +08:00
cac3cec135
Use i386/alpine:3.16 2024-01-02 19:08:56 +08:00
4e0efff4c4
Fix tests 2024-01-02 19:08:56 +08:00
71b7c96ddd
Use alpine:3.12
It appears tat at least alpine:3.16 is broken
and produces linking errors.
2024-01-02 19:08:56 +08:00
5ff61cdf86
Bump toolchain in cirrus CI 2024-01-02 19:08:56 +08:00
7d0ba7fc62
Bump llvm to 13 2024-01-02 19:08:56 +08:00
bfe56aed1f
Fix Dockerfile 2024-01-02 19:08:56 +08:00
a1103c05a5
Update ARM docker images 2024-01-02 19:08:56 +08:00
125125b9db
Downgrade cabal on armv7 2024-01-02 19:08:55 +08:00
4eec582f1b
Update alpine docker containers 2024-01-02 19:08:55 +08:00
e969489ca2
Fix build on windows 2024-01-02 19:08:55 +08:00
ec4a657b42
Update tools in CI 2024-01-02 19:08:55 +08:00
55030d83da
Merge branch 'issue-958' 2024-01-01 21:40:36 +08:00
Rune K. Svendsen
dfe213824f Improve NoDownload Pretty instance on missing/unknown "mtarget"
The guard was only used for the "Perhaps you meant"-part, so include the other part regardless of what `mtarget` is.
2023-12-30 14:13:16 +01:00
c680a9f33b
Support cygwin in bootstrap-haskell too
Fixes #958
2023-12-29 19:56:38 +08:00
df192ee18e
Merge remote-tracking branch 'origin/pr/956' 2023-12-26 21:41:40 +08:00
Rune K. Svendsen
008def2ff4 Add comment about why we ignore this error 2023-12-20 10:26:42 +01:00
Rune K. Svendsen
3976daddb7 bootstrap-haskell.ps1: don't exit if tmp file removal fails 2023-12-20 10:21:22 +01:00
524cdbbeb1
Merge remote-tracking branch 'origin/pr/953' 2023-12-15 23:53:59 +08:00
a01c5acfe2
Update submodules 2023-12-15 23:53:41 +08:00
Rune K. Svendsen
6689312ac5 docs: remove "TUI not supported on Windows"
TUI works on Windows since v0.1.20.0 (cf. https://github.com/haskell/ghcup-hs/pull/912)
2023-12-15 16:49:55 +01:00
e214695a3e
Merge remote-tracking branch 'origin/pr/850' 2023-12-02 18:42:22 +08:00
Yuto Tanaka
9d7f99bd00 Fix many typos 2023-11-30 18:12:46 +09:00
3cea6ef97c
Merge remote-tracking branch 'origin/pr/937' 2023-11-28 21:25:12 +08:00
3b0f131a65
Merge remote-tracking branch 'origin/pr/940' 2023-11-28 21:08:49 +08:00
konsumlamm
e0a3020e34
Update WASM install instructions 2023-11-28 13:55:52 +01:00
Luis Morillo
0e46b9509a complete tutorial. remove show all tools from widgets. resolve some conflicts. 2023-11-23 16:05:12 +01:00
Luis Morillo
d3474d0cd9 add KeyInfo handler and widget. Improve tutorial 2023-11-23 15:32:23 +01:00
Luis Morillo
5c3dad1bb9 reorganize code by sections 2023-11-23 15:31:33 +01:00
Luis Morillo
987cdaf313 factor out attr names. Add windows symbols to tutotial widget. Improve tutorial aesthetics and text 2023-11-23 15:28:21 +01:00
Luis Morillo
835352428a simplify rendering for better ux 2023-11-23 15:28:19 +01:00
Luis Morillo
8f4246e716 Use proper Name type and Modal type. Create tutorial Widget 2023-11-23 15:27:33 +01:00
Luis Morillo
1353a2fd20 use map-like data structure 2023-11-23 15:26:49 +01:00
Luis Morillo
aa9fbdbfc2 Use MonadState Instance to simplify install', del', set' and changelog'. Lensify the app 2023-11-23 15:24:24 +01:00
3a8cdf9967
Fix opening changelog on windows 2023-11-20 22:36:17 +08:00
2caf491e9d
Remove the "show all tool" config
We show all tools at the moment anyway.
2023-11-18 18:55:06 +08:00
d277e56121
Improve logging by dropping trailing newline 2023-11-18 13:09:19 +08:00
335099ad19
Add rocky/void detection 2023-11-17 17:03:10 +08:00
b1106985ec
Merge branch 'monday-improvements' 2023-11-14 23:16:42 +08:00
cd8ce9aaa9
Update test artifact upload 2023-11-14 22:11:28 +08:00
18f0cb086b
Fix tests 2023-11-14 09:37:07 +08:00
dee54445bf
Merge remote-tracking branch 'origin/pr/928' 2023-11-13 17:50:37 +08:00
Bryan Richter
2df59fd1b3
Emphasize experimental nature of wasm and js 2023-11-13 11:28:14 +02:00
2e5dee8e1a
Add mechanism to warn on new metadata versions, fixes #860 2023-11-13 16:53:24 +08:00
c6aa5c3ed7
Don't remove share dir link prematurely 2023-11-13 16:00:48 +08:00
47ef380ebd
Add update-shell-completions.sh 2023-11-13 16:00:31 +08:00
d6601b0353
Remove globalTools from metadata 2023-11-13 15:39:58 +08:00
0eba225723
Update modgraph 2023-11-13 15:21:54 +08:00
e7d91d138b
Improve metadata documentation 2023-11-13 15:19:58 +08:00
0103e2771e
Merge branch 'sunday-improvements' 2023-11-12 22:50:09 +08:00
b6246734e4
Givee cross bindists it's own doc section 2023-11-12 18:47:54 +08:00
6146c3494f
Improve documentation for cross bindists 2023-11-12 18:39:06 +08:00
e5a7a2da70
Fix prefetch for cross bindists 2023-11-12 18:21:49 +08:00
6047614a16
Be less confusing when user tries to 'set' ghcup in TUI
Fixes #923
2023-11-12 17:36:00 +08:00
6a86e9e77e
Fix failure mode when metadata is garbage, fixes #921 2023-11-12 17:11:33 +08:00
4132447e04
Require user to explicitly choose subcommand for 'ghcup config'
This should further reduce confusion wrt #922
2023-11-12 16:49:39 +08:00
9d223730de
Error out on empty UserSettings wrt #922 2023-11-12 16:49:06 +08:00
ad9199568b
Don't download twice when trying stack decoding 2023-11-12 16:24:39 +08:00
0d91c2ac14
Make install error more visible 2023-11-12 15:59:15 +08:00
8644ca41e1
Merge remote-tracking branch 'origin/pr/924' 2023-11-12 12:19:56 +08:00
Cheng Shao
6051c0cfbc
Bump minimum windows version to 8.1 2023-11-11 06:18:13 +01:00
67d977ce39
Update metadata submodule 2023-11-10 21:42:31 +08:00
8b6b3d2fbe
Update bootstrap script ghver 2023-11-10 21:41:19 +08:00
a5d228ba89
Bump to 0.1.20.0 2023-11-10 19:53:04 +08:00
a7be1e7068
Merge branch 'brick-windows' 2023-11-10 19:32:20 +08:00
30a10d871a
Update bootstrap script 2023-11-09 23:42:31 +08:00
90b0281c1c
Merge remote-tracking branch 'origin/pr/918' 2023-11-09 23:30:05 +08:00
Tom Smeding
bba92baeb1 Fix typo in ToolShadowed error for stack 2023-11-09 13:41:21 +01:00
e06a1c03d4
Merge remote-tracking branch 'origin/pr/911' 2023-11-09 18:00:06 +08:00
0171f2e870
Merge branch 'issue-914' 2023-11-09 17:53:42 +08:00
da078c7362
Use prompt for desktop shortcuts, fixes #914 2023-11-09 17:24:41 +08:00
94b4b7c455
Merge branch 'issue-913' 2023-11-06 22:12:46 +08:00
6aa486594a
Redo ghc-install.sh, fixes #913 2023-11-06 18:23:02 +08:00
2c3148abcc
Update supported tools table, fixes #915 2023-11-06 18:20:36 +08:00
dde32fa72e
Ensure patched version of vty-windows is used 2023-11-06 17:35:20 +08:00
675ab17fff
Improve signs on windows (no unicode) 2023-11-05 22:29:55 +08:00
9fcacbd96b
Fix CPP defines for windows+brick 2023-11-05 22:22:53 +08:00
ba4c6e5b99
Relax vector upper bound 2023-11-05 17:33:54 +08:00
f2b139b58b
Drop temp source-repository stanza for 'versions' 2023-11-05 17:32:25 +08:00
a44bf5884d
Enable tui for windows in release builds 2023-11-05 17:32:25 +08:00
64c1d63d33
Allow tui flag for windows as well 2023-11-05 17:32:25 +08:00
0300d8f2cc
Bump for brick windows 2023-11-05 17:20:29 +08:00
citrusmunch
bb395b652d
Fix typo in guide.md
xdg section is below (not above)
2023-11-01 12:04:43 -04:00
59bfdd9a30
Stack docs improvement 2023-10-25 15:01:18 +08:00
d85accb08e
Merge branch 'improve-stack-setup-use' 2023-10-25 15:01:04 +08:00
c7439d3c89
Improve stack metadata support wrt #892 2023-10-25 14:00:01 +08:00
38cd5ad8ed
Merge branch 'improved-key-brick' 2023-10-24 15:00:31 +08:00
5fd0fa8d8e
Merge branch 'issue-892' 2023-10-24 15:00:10 +08:00
452ca8cca2
Improve key handling in TUI, fixes #875 2023-10-23 22:47:17 +08:00
5f73320b29
Support stacks installation strategy and metadata wrt #892 2023-10-23 22:46:43 +08:00
d14526059b
Merge branch 'fixups' 2023-10-23 22:46:05 +08:00
b1cde06bd0
Fix CI 2023-10-23 21:42:29 +08:00
0adb602a96
Improve distro code 2023-10-23 21:42:29 +08:00
f9a2b21cb0
Update system requirements, fixes #902 2023-10-21 19:43:53 +08:00
e73cf4033e
Merge remote-tracking branch 'origin/pr/899' 2023-10-21 19:35:51 +08:00
5f0c6f60b8
Update data/metadata 2023-10-21 19:31:06 +08:00
29c9611152
Update system requirements in docs 2023-10-21 19:28:20 +08:00
e90ca97441
Fix property tests 2023-10-21 19:23:25 +08:00
1fb0387101
Add temp git ref to versions to fix CI 2023-10-21 19:23:25 +08:00
Colin Woodbury
1981a12e67
refactor: use upstream TH constructors 2023-10-21 19:23:25 +08:00
Colin Woodbury
eae197ccb3
chore: bump versions upper bound and squash warnings 2023-10-21 19:23:25 +08:00
Colin Woodbury
15c6ed2b8d
refactor: upgrade versions library usage 2023-10-21 19:23:25 +08:00
fbb648d984
Improve logging on broken symlinks wrt #880 2023-10-21 19:23:25 +08:00
Romain Ruetschi
c914a284de
Use absolute path to /usr/bin/xattr instead of pulling whatever is in PATH
On macOS systems with Homebrew installed, the latter will install its
own copy of `xattr` in `/opt/homebrew/bin/xattr` which will often
take precedence over the system `xattr` at `/usr/bin/xattr`, and does
not support the `-r` flag to act recursively over a directory.

This commit changes the invocation of `xattr` to use the absolute path
to the system version of `xattr` at `/usr/bin/xattr`.
2023-10-21 19:23:25 +08:00
9a17eaa32a
Bump metadata version since we added new distros 2023-10-21 19:23:24 +08:00
480d6be02f
Add explicit support for Void Linux, fixes #378 2023-10-21 19:23:24 +08:00
3e907bd890
Add explicit support for Rocky Linux 2023-10-21 19:23:24 +08:00
wz1000
d999c3dfbf
Update supported HLS versions 2023-10-21 19:23:24 +08:00
41d44b037d
Validate gpg sig even if using file:// yaml url 2023-10-21 19:23:24 +08:00
9d8d6e3293
Improve Github CI documentation 2023-10-14 11:58:09 +08:00
Adam Bergmark
8696a1c710
doc: change order of stack integration recommendations 2023-10-11 14:15:30 +02:00
2f107197d4
Merge branch 'issue-887' 2023-10-10 16:57:58 +08:00
486a1bac25
Fix segfault in TUI when hitting enter early
Fixes #887
2023-10-10 10:26:35 +08:00
a73ce186b5
Remove documentation of nightlies
GHC nightlies have been broken for a while and unless
they are not only fixed, but GHC upstream demonstrates that
they can make them work reliably, GHCup will not promote them.
2023-10-07 16:54:54 +08:00
76204aa366
Re-enable threaded runtime
Needed for vty.
2023-10-01 17:17:13 +08:00
502f0ea62f
Avoid module recompilation 2023-10-01 17:10:50 +08:00
e7e6663017
Update stackage to 20.26 2023-10-01 14:53:37 +08:00
e27fed09f3
Fix sdist 2023-10-01 14:45:41 +08:00
9eeac00714
Further improvement to tag documentation 2023-10-01 14:38:40 +08:00
c0ffb22d6a
Improve documentation around tags 2023-10-01 14:35:31 +08:00
f0b145d8dd
Merge remote-tracking branch 'origin/pr/890' 2023-09-30 15:20:42 +08:00
bb700281a3
Update gpg docs 2023-09-30 00:02:36 +08:00
openingnow
fcdec4ba2c
Add another cabal store path 2023-09-29 16:58:51 +09:00
371eda962f
Update system requirements for specific distro version
fixes #777
2023-09-04 15:08:24 +08:00
50252d8613
Merge branch 'fix-optparse-test' 2023-09-03 14:34:40 +08:00
78c393a16e
Fix optparse tests on windows 2023-09-02 18:47:42 +08:00
9c3478075f
Merge remote-tracking branch 'origin/pr/864' 2023-09-02 16:35:21 +08:00
7e7c11fda4
Merge remote-tracking branch 'origin/pr/868' 2023-09-02 16:34:30 +08:00
bff14761ac
Use optparse-test in release/build 2023-09-02 16:32:46 +08:00
99ddcc938f
cabal-fmt 2023-09-02 16:20:54 +08:00
e2301e2fa7
Merge remote-tracking branch 'origin/pr/862' 2023-09-02 16:19:56 +08:00
c52096671e
Merge remote-tracking branch 'origin/pr/873' 2023-09-01 13:13:10 +08:00
64f03a2f18
Merge remote-tracking branch 'origin/pr/877' 2023-08-29 18:19:04 +08:00
Fendor
a72b78ef96 Update supported tools table for HLS 2.2.0.0 2023-08-27 14:33:42 +02:00
Zubin Duggal
b17849c258
Add my GPG keys to the docs 2023-08-23 17:59:56 +05:30
d759535faa
Merge remote-tracking branch 'origin/pr/870' 2023-08-14 17:45:58 +08:00
Fendor
c25c07aa61 Update supported tool list 2023-08-12 11:56:12 +02:00
Lei Zhu
5f361e1e0b Fix compile test 2023-08-05 13:47:51 +08:00
Lei Zhu
bcb498de20 Merge branch 'master' into optparse-test-suite 2023-08-05 13:08:41 +08:00
Arjun Kathuria
fd6ff9f8ec pretty-print instances for VersionRange and VersionCmp types 2023-07-30 12:45:01 +05:30
Lei Zhu
69d311f0b4 ci 2023-07-29 00:43:33 +08:00
Lei Zhu
fde0e712ac add ci 2023-07-28 23:57:59 +08:00
Lei Zhu
c60aa767ca format 2023-07-28 23:48:03 +08:00
Lei Zhu
78df858ba1 run test 2023-07-28 23:39:21 +08:00
Lei Zhu
f1f4d5e836 gc test 2023-07-28 23:26:19 +08:00
Lei Zhu
2726e83235 whereis test 2023-07-28 23:00:15 +08:00
Lei Zhu
f23631054a compile test 2023-07-28 22:06:16 +08:00
Lei Zhu
9189f9a65a Add absolute description 2023-07-25 23:01:44 +08:00
Lei Zhu
7076472bde compile test 2023-07-25 22:58:01 +08:00
a2a605ad89
Merge remote-tracking branch 'origin/pr/867' 2023-07-25 18:10:40 +08:00
tomjaguarpaw
8fae9a5083
Fix spelling 2023-07-25 08:17:21 +01:00
Lei Zhu
6f07b6a343 compile test 2023-07-24 23:04:18 +08:00
Lei Zhu
dfebfc9504 upgrade test 2023-07-24 22:26:33 +08:00
Lei Zhu
36463ebf97 list test 2023-07-24 22:09:03 +08:00
Lei Zhu
f400f43b8c list test 2023-07-23 23:51:03 +08:00
a3748507ca
Merge branch 'ghc-compile' 2023-07-23 22:46:14 +08:00
Lei Zhu
c92875882a rm test 2023-07-23 16:30:25 +08:00
Lei Zhu
2df2e3da40 extend unset ghc optparse example 2023-07-23 15:47:47 +08:00
Lei Zhu
cf1e8659b0 unset test 2023-07-23 15:41:27 +08:00
Lei Zhu
fb2e3f2740 test test 2023-07-23 15:19:13 +08:00
578162f461
Merge remote-tracking branch 'origin/pr/866' 2023-07-23 12:37:20 +08:00
unleashy
29bc40f65b
Remove quote escapes 2023-07-22 18:41:00 -03:00
Lei Zhu
aafb77df7c install test 2023-07-22 23:10:27 +08:00
Lei Zhu
dc1a813305 config test 2023-07-22 17:46:23 +08:00
Lei Zhu
16c7ecabe2 nuke test 2023-07-22 17:20:42 +08:00
Lei Zhu
e1d8ba869a Add missing stack for changelog parser 2023-07-22 17:16:58 +08:00
Lei Zhu
38db038953 changlog test 2023-07-22 17:14:49 +08:00
Lei Zhu
bcdf2b23f1 debug-info test 2023-07-22 16:07:49 +08:00
Lei Zhu
83b82c328b Set test 2023-07-22 15:31:37 +08:00
c149ee8d2b
Print better error on 'ghcup <command> <tool>-<version>'
Wrt #180
2023-07-22 12:21:19 +08:00
Lei Zhu
c10924274d Set test 2023-07-22 11:45:29 +08:00
Lei Zhu
e13c5a99af Remove origin test to ghcup-test subdir 2023-07-20 23:09:14 +08:00
6623e4b1c8
Add GHC JS cross test 2023-07-19 08:12:10 +08:00
5170baf074
Fix cleaning up directories of compiled tools
'fromSrc' doesn't work well anyway.
2023-07-18 11:02:26 +08:00
d143daeb9a
Merge branch 'check-msys2' 2023-07-18 10:13:23 +08:00
699b183f62
Host msys2 on our servers and verify checksum
Wrt #836
2023-07-18 10:07:30 +08:00
09d72e7c97
Don't error on non-empty dirs during cleanup 2023-07-17 23:15:43 +08:00
d551cc8077
Better logging for cross removal 2023-07-17 23:15:43 +08:00
4698639da9
Test linux cross build 2023-07-17 21:25:19 +08:00
e67a9c93fe
Add documentation about Void Linux musl 2023-07-16 21:44:43 +08:00
621cc5782b
Consume 'VERSION' file if it exists 2023-07-16 21:22:37 +08:00
482503ca0a
Fix cross-compilation on make 2023-07-15 20:16:54 +08:00
2fb7328a6e
Detect hadrian/make automatically, wrt #846 2023-07-15 20:16:36 +08:00
06eae56646
Fix pulling freebsd bindist 2023-07-12 17:51:56 +08:00
bdbbeb1040
Bump version to 0.1.19.5 2023-07-12 01:05:23 +08:00
1eed02c8c7
Merge branch 'docker-gg' 2023-07-12 01:04:53 +08:00
6d325a1804
Fix docker builds 2023-07-11 23:44:49 +08:00
a05f272b58
Merge remote-tracking branch 'origin/pr/844' 2023-07-11 23:30:51 +08:00
07dfb1e94b
Fix tests 2023-07-08 00:07:29 +08:00
6ff07d3dbc
Disable fking cabal-cache 2023-07-07 23:41:28 +08:00
0da5572164
Don't need --bignum option 2023-07-07 23:20:16 +08:00
422b99a222
Make cabal-cache non-fatal 2023-07-07 23:20:06 +08:00
055df584a4
Avoid duplicates in cross compilers showing up 2023-07-07 21:09:55 +08:00
9798e0f1d2
Fix brick min size for version column 2023-07-07 17:37:20 +08:00
a43fa7d63e
More cross fixes to install bindist 2023-07-07 16:41:58 +08:00
4361ef7a72
Fix cross target being ignored 2023-07-07 00:39:31 +08:00
Sylvain Henry
3218aaa378
Allow cross-compilation with Hadrian 2023-07-07 00:38:50 +08:00
186a37cf3e
Fix cross bindist installation 2023-07-07 00:38:50 +08:00
Sylvain Henry
7b1f591cc4
Fix Lint issues 2023-07-06 20:49:57 +08:00
0ecd244177
Update playground link 2023-07-06 20:43:14 +08:00
e14600ae75
Update ghver in bootstrap script 2023-07-02 18:56:18 +08:00
0884756139
Update metadata 2023-07-02 18:55:57 +08:00
4c539d62c1
Add create yaml script 2023-07-02 18:55:40 +08:00
f5b58d1db7
Update metadata submodule 2023-07-02 15:35:39 +08:00
18f6a74d08
Bump cabal in CI to 3.10.1.0 2023-07-02 12:34:04 +08:00
becb3436d0
Bump to 0.1.19.4 2023-07-02 12:32:11 +08:00
1f220cd488
Update metadata submodule 2023-06-29 20:14:41 +08:00
572ee06bbb
Update ghcup version in bootstrap script 2023-06-29 20:12:10 +08:00
6e1380ef2e
Bump to 0.1.19.2, add changelog 2023-06-29 18:42:05 +08:00
3e83a7fd83
Merge branch 'nightlies' 2023-06-29 18:27:17 +08:00
34ac9cec4d
Add nightlies documentation 2023-06-29 14:47:49 +08:00
513f7446b3
Fix 2023-06-29 14:30:07 +08:00
aed478153d
Print alternative day if day not found 2023-05-14 22:06:38 +08:00
210816769a
Add dlOutput to DownloadInfo 2023-05-14 22:06:38 +08:00
42bf21c86e
Update stack 2023-05-14 19:43:50 +08:00
4b34cddcda
Implement support for nightlies, wrt #824 2023-05-14 19:43:49 +08:00
1ba2361fea
Fix ARMv7 build 2023-05-02 23:54:53 +08:00
278a3005d1
Merge remote-tracking branch 'origin/pr/818' 2023-05-01 16:02:32 +08:00
Luis Morillo
78d68e381a apply logging only on GHC uninstalation 2023-04-14 17:31:28 +02:00
17ffc459db
Merge remote-tracking branch 'origin/pr/811' 2023-03-25 16:45:12 +08:00
afcb482866
Update GPG keys 2023-03-25 15:33:56 +08:00
c28de19faa
Fix GC with XDG dirs, fixes #810 2023-03-18 22:04:37 +08:00
7ae952c82e
Merge remote-tracking branch 'origin/pr/809' 2023-03-18 12:26:32 +08:00
Ryan Davis
98098035c9
Use correct environment variable for STACK_ROOT
The environment variable used to set the root Stack directory was
incorrectly defined as STACK_ROOOT (typo with an extra 'O'). 

This has been fixed and the correct STACK_ROOT variable is now used.

See: https://docs.haskellstack.org/en/stable/environment_variables/#stack_root
2023-03-16 13:38:25 +11:00
acdc0786ba
Update tools table 2023-03-15 00:18:14 +08:00
7fa72a8892
Merge remote-tracking branch 'origin/pr/807' 2023-03-15 00:13:54 +08:00
fa22920e51
Merge branch 'docker-glibc' 2023-03-15 00:13:17 +08:00
f084fbce43
Fix f*ckup in docker image creation 2023-03-14 20:56:03 +08:00
Arjun Kathuria
1850c00e9d fix: project build error with new haskus-utils-variant version
* New haskus-utils-variant version 3.3 now includes the function
  "throwSomeE", which was now causing a compile error, since
  we have a function of the same name in our code.

* The function imported from the package and our own version clashed.

* Solution was to conditionally include our shim when haskus-utils-variant
  version < 3.3
2023-03-13 00:25:04 +05:30
c20deceaa8
Improve wording around FreeBSD support 2023-03-11 21:26:16 +08:00
89e4145baf
Merge remote-tracking branch 'origin/pr/805' 2023-03-11 21:23:31 +08:00
Alexey Vyskubov
f5f7c26d8a
Adds some information about FreeBSD installation. 2023-03-07 13:01:20 +02:00
784942ca58
Update submodule 2023-02-24 20:03:25 +08:00
75de2a7bc1
Merge branch 'ghcup-0.1.19.2' 2023-02-24 20:03:14 +08:00
ea6c8d338c
Bump ghcup in bootstrap script 2023-02-24 19:52:50 +08:00
ae625b181c
Improve pull_release_artifacts 2023-02-24 19:52:41 +08:00
89ae54a083
Set release date 2023-02-24 00:00:29 +08:00
1bd73591ba
Update data/metadata 2023-02-23 23:58:16 +08:00
f709f6e714
Update ChangeLog 2023-02-23 23:56:46 +08:00
3d7e07c371
Merge branch 'issue-796' 2023-02-23 23:52:38 +08:00
8bf17379ac
Fix windows bootstrap, fixes #796 2023-02-23 23:41:25 +08:00
4b1225ad71
Merge branch 'issue-797' 2023-02-23 23:15:48 +08:00
d628848af6
Silence hlint 2023-02-23 23:15:08 +08:00
48381be001
Bump GHC 9.2.5 to 9.2.6 2023-02-23 23:07:46 +08:00
b547324253
Smarter variants for 'listDirectory', fixing #797 2023-02-23 21:47:50 +08:00
2b1599c234
Fix windows golden file 2023-02-23 20:57:40 +08:00
7ac8989dfc
Bump to 0.1.19.2 2023-02-21 23:01:08 +08:00
cd6666ed30
Merge branch 'latest-prerelease' 2023-02-21 23:00:47 +08:00
5b7478438a
Merge branch 'issue-787' 2023-02-21 23:00:31 +08:00
4a830d9fb7
Fix regression in JFS support, fixes #787 2023-02-21 22:48:22 +08:00
785fb895b4
Implement 'latest-prerelease' tag wrt #788 2023-02-21 22:22:11 +08:00
75e801e9e6
Merge branch 'ghcup-0.1.19.1' 2023-02-20 00:03:26 +08:00
6ffd5328a4
Improve sftp-symlink-artifacts.sh 2023-02-20 00:01:11 +08:00
ed509e482b
Improve pull_release_artifacts 2023-02-19 23:58:25 +08:00
420323f43b
Update bootstrap script to 0.1.19.1 2023-02-19 23:58:07 +08:00
432962792c
Update ghcup-metadata 2023-02-19 22:56:33 +08:00
cb193f6069
Update ChangeLog for 0.1.19.1 2023-02-19 22:55:47 +08:00
2f268b6a25
Bump GHCup version 2023-02-19 22:44:28 +08:00
580606af14
Merge remote-tracking branch 'origin/pr/773' 2023-02-19 22:42:08 +08:00
faa1c3992b
Merge branch 'issue-762' 2023-02-19 22:41:27 +08:00
d17efef853
Merge branch 'issue-784' 2023-02-19 21:38:41 +08:00
179d4dd493
Fixup 2023-02-19 19:33:01 +08:00
e03c5ee4a1
Don't fail on setModificationTime, fixes #784
Related:

* https://github.com/actions/runner-images/issues/7061
* https://github.com/actions/runner-images/pull/7068
2023-02-19 19:24:45 +08:00
e57a8abd3d
Merge branch 'issue-751' 2023-02-19 19:23:48 +08:00
5fa10390a3
Fix CI 2023-02-19 19:15:09 +08:00
e1e6f579d5
Use debian:10 rather 2023-02-19 18:48:42 +08:00
72f8e53344
Fix CI 2023-02-19 17:32:28 +08:00
9c464ec9fc
Don't fail if the duplicate is the last element 2023-02-19 17:25:14 +08:00
1c9b296a5e
Merge remote-tracking branch 'origin/pr/782' 2023-02-18 19:44:25 +08:00
Bryan Richter
275522584e
Remove deprecated www 2023-02-17 13:30:29 +02:00
Bryan Richter
804520c4bb
Remove duplicate js/css includes 2023-02-17 12:56:51 +02:00
Bryan Richter
9d25581f3c
Use favicon from gitlab.haskell.org
The current .png is presumably the wrong shape and looks flattened.

Plus, mkdocs complained that 'site_favicon' was an unrecognised
configuration name, so I used the method described in the docs instead:

https://www.mkdocs.org/user-guide/customizing-your-theme/#using-the-theme_dir
2023-02-17 12:55:27 +02:00
Bryan Richter
e798037d80
Simplify removal of next/prev buttons
As documented on how to override template blocks:

https://www.mkdocs.org/user-guide/customizing-your-theme/#overriding-template-blocks

This is a big diff. I tested it by generating docs before and after the
change, and they were functionally identical.
2023-02-17 12:53:28 +02:00
Bryan Richter
2afe5858cb
Remove unused/missing javascript 2023-02-17 10:44:34 +02:00
f575dcdad6
Improve usability on 'ghcup config add-release-channel'
Fixes #751 (or so I hope).
2023-02-12 19:58:08 +08:00
6cf9967e7c
Work around missing libtinfo.so.6 2023-02-12 18:41:40 +08:00
15a75d790a
Build arm binaries in bionic images, fixes #762 2023-02-12 17:16:32 +08:00
988672ea75
Build arm images for bionic as well wrh #762 2023-02-12 17:16:27 +08:00
6d3e8d65e1
Make readDirEntPortable more robust 2023-02-11 18:51:34 +08:00
895e4b3f18
Merge branch 'issue-775' 2023-02-11 18:38:39 +08:00
20f0505120
Don't implicitly smuggle in config options
Fixes #775
2023-02-09 00:04:53 +08:00
31e83cac5e
Don't configure meta-mode = Strict in bootstrap 2023-02-08 22:42:17 +08:00
ksqsf
9baba88f75
Add a known mirror 2023-02-08 22:09:04 +08:00
d3a1115b99
Fix FreeBSD URL 2023-02-04 01:00:52 +08:00
6d46849fec
Merge remote-tracking branch 'origin/issue-766' 2023-02-03 23:58:50 +08:00
53e324bfee
Fix failure on JFS filesystems
Some filesystems always return DT_UNKNOWN for d_type, since
it's non-portable.

For those cases we use 'stat' to figure out the file type.

Similar to: https://github.com/ggreer/the_silver_searcher/pull/37
2023-02-03 22:48:05 +08:00
2e39b7b603
Fix FreeBSD URL 2023-02-03 22:43:41 +08:00
048932bf50
Fix _eghcup invocations 2023-02-01 16:53:25 +08:00
69d325bf90
Set metadata fetching mode to strict in bootstrap script
And improve error messages.
2023-02-01 16:44:10 +08:00
3d1b8859cd
Merge remote-tracking branch 'origin/pr/759' 2023-01-26 22:05:35 +08:00
db89ca9942
Merge remote-tracking branch 'origin/pr/758' 2023-01-26 22:05:30 +08:00
bba009d98c
Merge remote-tracking branch 'origin/pr/760' 2023-01-26 22:04:38 +08:00
9d954ea174
Add platforms to i386 alpine 2023-01-26 21:18:11 +08:00
da9c9049d2
Fix alpine32/Dockerfile 2023-01-26 21:04:07 +08:00
a4c00d2c56
Make version shortcuts work with 'ghcup set', fixes #757 2023-01-24 15:24:03 +08:00
Zixian Cai
b30f565871
Fix index.md as well 2023-01-23 16:07:36 +11:00
Zixian Cai
fa378a1d34
Fix section hyperlink 2023-01-23 16:06:00 +11:00
timo-a
119efb1ff4
fix link
currently resolves to: https://www.haskell.org/ghcup/install/install/#supported-tools
this commit fixes it to https://www.haskell.org/ghcup/install/#supported-tools
2023-01-22 15:36:14 +01:00
1fb4101b49
Fix msys2 URL, wrt #755 2023-01-21 17:58:26 +08:00
ec8333b223
Small CI fixes 2023-01-18 22:04:02 +08:00
54b979aa0b
Merge remote-tracking branch 'origin/pr/748' 2023-01-16 21:14:15 +08:00
ba274307c0
Improve CI 2023-01-16 20:29:16 +08:00
Rui Chen
a623d0809d
build: remove travis config
Signed-off-by: Rui Chen <rui@chenrui.dev>
2023-01-14 13:24:45 -05:00
e00899d176
Disable simdutf on windows, wrt #745 2023-01-14 00:59:52 +08:00
a38ca1954b
Fix build on unix with -ftui 2023-01-13 12:33:40 +08:00
3f5a19c63e
Post release cleanup 2023-01-13 12:07:32 +08:00
525e9672e8
Make cirrus CI task discoverable 2023-01-13 11:16:13 +08:00
070c6e1cf1
Add missing entry to CHANGELOG 2023-01-13 10:57:57 +08:00
195fd00e0a
Add CHANGELOG for 0.1.19.0 2023-01-13 10:41:49 +08:00
733d014c19
Bump version to 0.1.19.0 2023-01-13 10:13:51 +08:00
16039769d5
Refreeze 2023-01-13 10:12:34 +08:00
5eeb8ca9fc
Fix windows 2023-01-13 00:26:15 +08:00
317a06bbc3
Fix ARM build 2023-01-13 00:03:12 +08:00
f693adcd7c
Fix FreeBSD build for text-2.0 2023-01-12 23:53:03 +08:00
ac88d2bd50
Fix cache eviction 2023-01-12 23:44:53 +08:00
a427146de5
Update dependencies and make buildable with GHC-9.4.4 2023-01-12 13:52:08 +08:00
a16bcddeaa
Update dependencies 2023-01-12 13:01:12 +08:00
74edf1fc07
Merge branch 'testsuite' 2023-01-12 12:58:39 +08:00
1e32639873
Implement 'ghcup test ghc' based on the bindist testsuite 2023-01-12 12:58:10 +08:00
0704d2640a
Document how to install windows manually, fixes #697 2023-01-12 00:45:16 +08:00
26a6368d79
Merge remote-tracking branch 'origin/pr/700' 2023-01-08 22:26:19 +08:00
54af66d115
Merge branch 'HF-errors' 2023-01-05 21:39:23 +08:00
850799c21a
Merge remote-tracking branch 'origin/pr/739' 2023-01-05 21:32:07 +08:00
d4834d7541
Update docs/about.md
Co-authored-by: tomjaguarpaw <tom-github.com@jaguarpaw.co.uk>
2023-01-05 07:32:51 +08:00
2895dd9d13
Bump cabal-cache with amazonka patch 2023-01-04 21:08:10 +08:00
eb9a0b66c4
Document distribution policies 2023-01-04 18:51:40 +08:00
8d0432b961
Make sure FreeBSD runner uses GMT
This should fix parsing issues in amazonka and
cabal-cache:

* https://github.com/haskell-works/cabal-cache/issues/207
* https://github.com/brendanhay/amazonka/issues/866
2023-01-04 16:56:07 +08:00
ab2c01d1c9
Don't install stack by default in CI 2023-01-04 16:50:55 +08:00
fffaa65b7f
Don't install stack by default in CI 2023-01-04 00:58:05 +08:00
703be0a706
Add support for mirrors wrt #357 2023-01-04 00:36:07 +08:00
4be97ffd7c
Pad and use hyperlinks 2023-01-03 23:43:46 +08:00
009f9211a9
Integrate with errors.haskell.org
Fixes #434
2023-01-03 23:43:46 +08:00
109187eb6f
Merge branch 'issue-367-content-prop' 2023-01-03 23:17:35 +08:00
e881705323
Merge branch 'issue-440' 2023-01-03 22:47:12 +08:00
ea06c155a7
Merge branch 'issue-695' 2023-01-03 22:46:52 +08:00
d4732e15a7
Merge branch 'issue-716' 2023-01-03 22:46:13 +08:00
db6f784a1f
Merge branch 'error-handling' 2023-01-03 22:45:25 +08:00
82e3837dd9
Update windows golden test file 2023-01-02 21:42:52 +08:00
957c5918b8
Upload golden files on failure 2023-01-02 20:47:49 +08:00
9d4c923649
Add content-length property to downloads
This is optional for now. Fixes #367
2023-01-02 20:41:42 +08:00
24c36ef856
Fix failure with --isolate=dir --force
Fixes #695
2023-01-02 20:39:27 +08:00
2783b8f693
Fix 'ghcup install hls -u' on windows
Fixes #716
2023-01-02 20:38:58 +08:00
d5a680e3c6
Don't clean up tmp dirs when --keep=always 2023-01-02 20:38:26 +08:00
d1075987de
Fix ARM cleanup 2023-01-02 20:35:46 +08:00
e116a2392e
Enable arm tests 2023-01-01 21:40:04 +08:00
7dd6f1f4a4
Expose metadata-caching to --help 2023-01-01 19:19:37 +08:00
4d82c37539
Add --metadata-fetching-mode arg, fixes #440 2023-01-01 19:16:32 +08:00
801b1edfa7
Merge remote-tracking branch 'origin/pr/730' 2022-12-31 21:10:59 +08:00
c1b67e1787
Merge branch 'issue-433' 2022-12-27 00:11:23 +08:00
70dd106549
Merge branch 'issue-708' 2022-12-27 00:10:41 +08:00
b098aa4e65
Merge branch 'issue-368' 2022-12-27 00:09:59 +08:00
74b784fcfb
Merge branch 'issue-391-gh' 2022-12-27 00:09:39 +08:00
673db344d6
Merge branch 'issue-414' 2022-12-27 00:09:28 +08:00
5594a19c02
Merge branch 'issue-384' 2022-12-27 00:09:05 +08:00
Kristoffer Grundström
a5bc13fe50
Added Mageia
Signed-off-by: Kristoffer Grundström <lovaren@gmail.com>
2022-12-25 08:02:41 +01:00
a5f2067d76
Improve stripping logic 2022-12-21 13:44:31 +08:00
be8fa57be1
Freeze the MSYS2 version we install
Fixes #368
2022-12-20 23:38:48 +08:00
6ad9963889
Allow building newer GHCs from git
The user will have to pass --overwrite-version=<ver> because
we can't discover the GHC version from git anymore.

https://gitlab.haskell.org/ghc/ghc/-/issues/22322
2022-12-20 23:18:44 +08:00
bcddb05b1d
Fix bootstrap under windows when msys2 has non-posix login shell 2022-12-20 22:46:58 +08:00
f7d2033e25
Improve postRm message, fixes #384 2022-12-20 22:20:10 +08:00
6ce7649cfe
Improve upgrade warning wrt #414 2022-12-20 21:49:26 +08:00
cb0d8b80c3
Merge branch 'retry-cache' 2022-12-20 15:41:25 +08:00
95869f9560
Improve CI 2022-12-20 14:00:26 +08:00
e8586cf993
Improve add-release-channel, fixes #708 2022-12-20 00:57:56 +08:00
d195a3f86c
Merge branch 'issue-706' 2022-12-19 02:03:47 +08:00
b171afa09d
Document GHCUP_MSYS2, fixes #427 2022-12-19 00:52:11 +08:00
5cf49bffac
Improve warning for incompatible HLS/GHC combos 2022-12-19 00:40:07 +08:00
5659de8516
Improve hyperlinks 2022-12-19 00:16:48 +08:00
0cd2b6d549
Improve documentation on stack hooks 2022-12-19 00:10:49 +08:00
ae092de4b6
Update CI 2022-12-18 22:00:33 +08:00
a7e6e7c27d
Merge branch 'cirrus' 2022-12-16 19:12:49 +08:00
175a301a0d
Cirrus CI 2022-12-16 18:25:17 +08:00
823458910b
Merge branch 'armv7-aarch64' 2022-12-11 22:12:49 +08:00
2abcb46199
Fix ARM etc 2022-12-11 22:11:58 +08:00
75b891147a
Add packages for VoidLinux 2022-12-03 17:22:03 +08:00
de208f004e
Make sure powershell installation snippet doesn't crash parent shell
Fixes #418
2022-12-03 16:29:01 +08:00
ecb0676fea
Merge branch 'cleanup-docs' 2022-12-03 15:29:47 +08:00
957867ff1c
Fix remaining gitlab links wrt #692 2022-11-22 19:06:12 +08:00
b1b21f000d
Also update README 2022-11-20 23:47:53 +08:00
fbbafc33be
Yes, ghcup is the main installer 2022-11-20 23:44:39 +08:00
4a46de4c49
Switch releases to Github CI 2022-11-20 23:29:56 +08:00
77419ea41d
Fix nuke bug on windows 2022-11-20 23:29:56 +08:00
043500e8e8
Optimize 'ghcup whereis ghcup' 2022-11-20 23:29:56 +08:00
e924ad8278
Allow to statically overwrite distro detection, fixes #421 2022-11-12 14:12:13 +08:00
010db93b93
Fix install page 2022-11-12 11:25:52 +08:00
9fdc6eebe8
Add system requirements do documentation wrt #411 2022-11-12 11:17:27 +08:00
7c8d013b6e
Update tools table 2022-11-10 23:32:46 +08:00
96eb0c3532
Docs improvements 2022-11-10 23:28:39 +08:00
94c01ee362
Update tool tables 2022-11-10 23:22:29 +08:00
4297a46f13
Merge remote-tracking branch 'origin/merge-requests/290' 2022-11-10 23:12:18 +08:00
c07e1bbc8f
Merge remote-tracking branch 'origin/merge-requests/288' 2022-11-10 23:00:06 +08:00
9ee2df3841
Merge remote-tracking branch 'origin/merge-requests/286' 2022-11-10 22:59:48 +08:00
3c5505d222
Fix disabling installation of stack
Fixes #429
2022-11-10 22:38:30 +08:00
Will Badart
70df740f9d Check $ZDOTDIR in bootstrap script
Zsh looks for .zshrc in $ZDOTDIR, or $HOME if $ZDOTDIR is unset. I doubt
non-$HOME $ZDOTDIRs are widespread (I might be the only one I know with
one), but it's how zsh's startup is defined, so it can happen.

This commit simply adds a check to the `*/zsh` case of `find_shell()` to
respect $ZDOTDIR if it is set.
2022-10-28 17:01:38 +00:00
Jaro Reinders
761f3253c3 Fix broken link to included libraries 2022-10-25 18:21:06 +00:00
787edc17af
Improve stack GHC install script 2022-09-30 13:59:43 +08:00
9902adab6d
Make stack GHC install hook posix compliant
See https://github.com/commercialhaskell/stack/issues/5888
2022-09-30 13:29:57 +08:00
156b4724f3
Merge branch 'stack-hook' 2022-09-26 22:53:40 +08:00
e9575aba5c
Add stack ghc installation hooks and install stack by default 2022-09-22 00:04:14 +08:00
81c7f6a32a
Merge remote-tracking branch 'origin/merge-requests/283' 2022-08-24 22:34:21 +08:00
taylorfausak
ab97c80b80 Fix build error 2022-08-23 11:59:08 +00:00
taylorfausak
04369673ef Fix spacing 2022-08-23 11:19:33 +00:00
taylorfausak
63dfdc2da6 Remove hard-coded reference to "cabal"
Fixes #407.
2022-08-22 19:35:38 +00:00
14de382129
Merge remote-tracking branch 'origin/merge-requests/282' 2022-08-12 22:20:45 +08:00
d97c10dbe6
Merge remote-tracking branch 'origin/merge-requests/281' 2022-08-12 22:20:25 +08:00
Cheng Shao
8420bf093e Update ghc-head bindist URL 2022-08-09 13:32:58 +00:00
amesgen
5e28074522
Account for GHC 9.4.1 2022-08-09 00:43:55 +02:00
c842c41a78
Bump to 0.1.18.1 for hackage 2022-08-06 19:11:47 +08:00
8b93eaad59
cabal-fmt 2022-08-06 19:08:34 +08:00
2cba97cf1c
Merge remote-tracking branch 'origin/merge-requests/277' 2022-08-06 19:07:59 +08:00
7d74178295
Merge remote-tracking branch 'origin/merge-requests/279' 2022-08-06 19:07:50 +08:00
c37bef55e9
Merge remote-tracking branch 'origin/merge-requests/278' 2022-08-06 19:07:34 +08:00
837ba8b46a
Merge remote-tracking branch 'origin/merge-requests/280' 2022-08-06 17:41:09 +08:00
Dmitrii Kovanikov
c25e73408a Change attribution for the Haskell Beginners 2022 course 2022-08-06 09:33:01 +00:00
why-not-try-calmer
71c3172cf5 Less duplication. 2022-08-05 13:03:02 +02:00
why-not-try-calmer
1f2855a107 Added and referenced solution in case of 'ghc version not found' for Linux VSCode + hls extension users. 2022-08-05 12:51:46 +02:00
Artem Pelenitsyn
d949c4375e docs: add example of installing bindinst specified by job id 2022-08-05 02:27:35 +00:00
FTS
22f0081303 include c header file in sdict 2022-07-30 16:41:16 +00:00
5562be18e3
More docs improvements 2022-07-30 17:18:42 +08:00
6baa891424
Update metadata 2022-07-30 10:51:41 +08:00
a544feffb3
Finalize release 2022-07-30 10:29:34 +08:00
3b6bb0df46
Add changelog 2022-07-29 21:52:56 +08:00
60299b6bb8
Update HLS doc link 2022-07-27 23:29:33 +08:00
4d20f4e07c
Merge branch 'issue-391' 2022-07-25 20:33:21 +08:00
5f6b5f845d
Add --disable-ld-override for darwin bindists
Fixes #391
2022-07-25 17:57:10 +08:00
b0fecce0d1
Merge remote-tracking branch 'origin/merge-requests/273' 2022-07-24 20:24:00 +08:00
Mike Pilgrem
27c06ddde7 Fix #293 Document expressly how installation scripts can be customised
The proposed addition does not go into the mechanism (the names of the specific environment variables or the PowerShell parameters) but is more express about in what manner the behaviour of the installation scripts can be changed.

Introduces that important flexibility as the first topic under 'More on installation'.

Explains that the PowerShell script finally (by default) runs the script for Unix-like operating systems (so a Windows user understands better that the environment variables in the former are applicable to both, and what is meant by the 'final' bootstrap script in the content of the Windows parameters).

Refers to what has gone before, under 'Continuous integration', rather than repeat the added content.
2022-07-23 21:32:15 +01:00
3154d2839b
Merge remote-tracking branch 'origin/merge-requests/272' 2022-07-23 23:27:33 +08:00
Mike Pilgrem
511d8d5ed8 Update guide.md to explain what is meant by 'TUI'. 2022-07-23 14:25:49 +00:00
fe22405ee1
Merge branch 'issue-383' 2022-07-12 20:44:09 +02:00
ea828cd13a
Fix non-interactive install on windows 2022-07-12 20:26:57 +02:00
00fa70b9de
Merge remote-tracking branch 'origin/merge-requests/266' 2022-07-12 00:15:14 +02:00
823275363c
Merge branch 'ghcup-run-improvements' 2022-07-12 00:10:17 +02:00
2f299ee48d
Merge branch 'hls-hackage' 2022-07-12 00:06:40 +02:00
284fe1b3b6
Fix parser and completer for 'ghcup compile hls --version' 2022-07-12 00:05:08 +02:00
35bda8d67a
Fix hlint warnings 2022-07-11 19:49:08 +02:00
7a2a5074fa
Fix parsing issues with 'ghcup run' and non-PVP versions
This is a major refactor of some CLI code. We try to distinguish
GHC versions from other versions, so that we can use distinct parsers.

Hopefully this doesn't introduce new bugs.

This also forces ghcup run to use the new internal ~/.ghcup/tmp dir.
2022-07-11 19:45:15 +02:00
ce239ab88e
Fix error message 2022-07-11 19:44:10 +02:00
f3c703d655
Support hls in 'ghcup changelog' 2022-07-11 19:44:10 +02:00
b6ff5bc764
Use ghcup's internal dir for 'ghcup run' 2022-07-11 19:43:48 +02:00
b8aeb1f935
Fix guide 2022-07-11 00:43:18 +02:00
9673d28d3e
Docs 2022-07-11 00:40:39 +02:00
99a51d67a1
Make compiling from hackage the default 2022-07-10 21:58:03 +02:00
b0ef0590a2
Merge branch 'pwsh' 2022-07-10 21:21:17 +02:00
256e1942f2
More stuff 2022-07-10 21:19:45 +02:00
aa71f0dfa1
Set wget 2022-07-10 21:05:51 +02:00
04d527c98a
Add DisableCurl powershell switch 2022-07-10 20:58:30 +02:00
Arjun Kathuria
ca5c5550ab removes newline after set' function 2022-07-10 21:49:54 +05:30
7b59621179
Support wget in bootstrap script 2022-07-10 17:56:00 +02:00
9d59463ded
Add GHCUP_CURL_OPTS to bootstrap script 2022-07-10 17:35:45 +02:00
Arjun Kathuria
3d49f79beb removes prettyShow from error case in BrickMain set' 2022-07-10 09:52:57 +05:30
Arjun Kathuria
e9740d13fc Updates userPrompt in BrickMain to a more efficient version 2022-07-10 09:50:58 +05:30
Arjun Kathuria
2bd5a8fe1a Removes redundant putPrompt function from Prompts module. 2022-07-10 09:45:39 +05:30
Arjun Kathuria
0acccae523 Removes GHCup.Types.Prompts module and stuffs it into GHCup.Types 2022-07-10 09:44:23 +05:30
974112016e
Allow to run 'cabal update' automatically before the HLS build 2022-07-09 23:50:20 +02:00
9fb2889696
Allow to build from arbitrary GHC source dists 2022-07-09 23:12:00 +02:00
63f22b28d7
Allow to build HLS from hackage 2022-07-09 21:12:23 +02:00
9a72fa13d5
Relax Cabal bounds 2022-07-09 18:04:03 +02:00
86a8a32032
Merge branch 'issue-380' 2022-07-07 17:04:42 +02:00
13e01ab453
Fix hlint warnings 2022-07-07 15:05:51 +02:00
873dd77a6f
Fix build on windows 2022-07-07 15:05:51 +02:00
544c618473
Don't remove legacy dir if it doesn't exist 2022-07-07 14:03:49 +02:00
a264cb088e
Improve 'ghcup compile hls'
1. short hashes now work
2. print the long hash in addition to the detected cabal version of HLS
3. add `--git-describe-version` switch as an alternative to
   `--overwrite-version`

Fix 1. and 2. for GHC as well.
2022-07-06 22:49:11 +02:00
1a43fddca9
Improve about docs 2022-07-02 20:34:19 +02:00
Arjun Kathuria
9ceb66ef21 chore: fix a hlint warning 2022-06-28 22:10:02 +05:30
Arjun Kathuria
7cbe38b011 Behavior Enhancement: make user press "S" only once to set, asks to install AND set if tool uninstalled 2022-06-28 19:50:22 +05:30
Arjun Kathuria
3bbc1edb19 updates user prompt message for "set" uninstalled version in BrickMain 2022-06-28 19:49:00 +05:30
Arjun Kathuria
b8dac2d7cd Updates the Prompt module to use logInfo instead of putStrLn,
makes the prompt look prettier
2022-06-28 19:45:17 +05:30
bdfb1a3a9b
Merge remote-tracking branch 'origin/merge-requests/264' 2022-06-26 23:14:36 +02:00
9b8b3e8126
Merge remote-tracking branch 'origin/merge-requests/263' 2022-06-26 23:14:10 +02:00
d657c17df4
Merge branch 'issue-375' 2022-06-26 23:11:32 +02:00
Arjun Kathuria
0e1fd68d93 when setting an uninstalled tool in tui, asks user to install first 2022-06-25 13:45:07 +05:30
Arjun Kathuria
c7eceb2330 Adds GHCup.Prompt modules and its types to project 2022-06-25 13:44:25 +05:30
why-not-try-calmer
e143c06697 VSCode integration
Typo
2022-06-16 11:07:12 +02:00
Jens Petersen
29da21f5dc bootstrap-haskell: s/will download/can download/
A one word tweak to weaken the language in the initial explanation
to make it "less scary": in general ghcup does not always download
all of ghcup, ghc, cabal, stack, and hls
(unless requested or they are not already installed, etc),
but "will download" sounds like the user is has no choice here
except to always download everything,
which might give them second thoughts about trying this script
and hence adopting ghcup.

Perhaps the wording could be made further more precise,
but at least "can" gives one less anxiety.
2022-06-11 13:06:54 +08:00
028696d4be
Merge branch 'issue-377' 2022-06-09 15:29:01 +02:00
4022edb12e
Allow passing bindist configure args wrt #377 2022-06-09 14:42:01 +02:00
fde5044194
Merge branch 'issue-371' 2022-06-07 18:44:31 +02:00
3af1286ab7
Fix ghcup_bootstrap test 2022-06-07 17:49:33 +02:00
bcff46d3d4
Fix mingw PATH handling wrt #371 2022-06-07 14:37:23 +02:00
d1c72cdff4
Add --mingw-path switch to 'ghcup run' 2022-06-06 23:03:45 +02:00
565bb59f45
Fix ghcup_bootstrap test 2022-06-06 23:03:07 +02:00
aae3f31c50
Fix bootstrap-haskell picking system cabal 2022-06-06 23:03:07 +02:00
0ce9b5d352
Fix test 2022-06-06 23:03:07 +02:00
bf0e5b37ca
Test issue #375 2022-06-06 20:22:45 +02:00
fe620835be
Fix 'ghcup run' on windows, fixes #375 2022-06-06 20:18:10 +02:00
c7dc77e6bc
Refreeze 2022-06-05 17:18:44 +02:00
05c72a3de6
Fix build with 9.2.3 2022-06-05 16:55:08 +02:00
0653844931
Fix build with ghc-9.0.2 2022-06-04 23:15:06 +02:00
7661046bcb
Update GHC version table 2022-05-28 16:44:15 +02:00
16888a12d4
Cleanup 2022-05-28 16:44:08 +02:00
9f7df33692
Merge branch 'issue-367' 2022-05-24 12:44:57 +02:00
b7007aa100
Merge branch 'excepts-refac' 2022-05-24 12:44:39 +02:00
03dfd0cba0
Require --isolate to have an absolute directory, fixes #367 2022-05-23 23:50:49 +02:00
0e64d1f22f
Improve AlreadyInstalled 2022-05-23 23:49:43 +02:00
c7774450bf
Refactor excepts 2022-05-23 23:37:09 +02:00
9375255452
Warn on all tools when shadowed 2022-05-23 16:50:23 +02:00
b8b3a16589
Update modgraph 2022-05-23 00:00:57 +02:00
e1d86c77d0
Merge branch 'issue-364' 2022-05-22 23:39:41 +02:00
001d33eabb
Use 'cabal update' 2022-05-22 22:47:40 +02:00
2845425099
Restructure modules 2022-05-22 21:11:40 +02:00
c56b9ec3ce
Make windows mergeFileTree more robust 2022-05-21 20:51:13 +02:00
68c81577a4
Fix HLS install via compile 2022-05-21 15:03:20 +02:00
b5fb8772fe
Fix windows 2022-05-21 11:34:57 +02:00
5741e069ad
Fix deletion on missing files 2022-05-20 23:29:31 +02:00
df89ddcdf5
Use internal tmpdir 2022-05-20 23:19:33 +02:00
c9e1261af2
Some fixes 2022-05-20 00:46:50 +02:00
d5efc86d85
Preserve mtime when merging filetrees 2022-05-20 00:32:22 +02:00
430b655785
Improve error handling for mergeFileTree 2022-05-20 00:15:25 +02:00
1cffa358b8
Fix M1 CI 2022-05-19 21:01:48 +02:00
ca89112a8e
Fix for darwin M1 2022-05-17 01:55:56 +02:00
65f02a5a7a
Fix test 2022-05-16 23:04:49 +02:00
9ccf29903e
Add Ben's GPG key 2022-05-16 21:40:02 +02:00
e4b8c9748a
Fix oleg url 2022-05-16 18:03:19 +02:00
3318c30cee
Fix stack.yaml 2022-05-16 17:38:46 +02:00
b9aba98cd5
Fix recursive deletion in ghcup nuke 2022-05-16 17:38:05 +02:00
55fdc41137
WIP 2022-05-16 11:29:55 +02:00
c9790e5823
Use strongly types GHCupPath and restrict destructive operations 2022-05-13 21:35:34 +02:00
fa924eac15
Fix CI 2022-05-13 17:59:38 +02:00
db4e411dfd
Fix darwin binaries after copying 2022-05-13 17:58:15 +02:00
48aee1e76c
[WIP] Prototype of recording installed files
This also installs makefile based build system via DESTDIR
into a temporary directory and then merges it into the filesystem.
2022-05-13 00:46:47 +02:00
2a2ace603b
Bump 2022-05-12 18:35:38 +02:00
25f9ac71ca
Merge branch 'windows-hotfix' 2022-05-12 18:33:19 +02:00
61e2801838
Windows fix 2022-05-12 18:03:04 +02:00
e60b8ee238
Merge branch 'CIi' 2022-05-12 17:15:55 +02:00
dc0ea5a59c
Document and handle '--force' option better 2022-05-12 13:28:09 +02:00
10e704cd73
Fix CI 2022-05-12 13:17:40 +02:00
8004cc0537
Make sure root-clenaup runs 2022-05-12 01:12:45 +02:00
0a2373f407
Fix CI 2022-05-12 00:17:46 +02:00
96f87eaf5f
Update timestamp in CHANGELOG 2022-05-11 23:52:19 +02:00
e9bd687b8f
Update ghcup version in bootstrap-haskell 2022-05-11 23:39:45 +02:00
3ffa38cf98
Update guide 2022-05-11 23:39:37 +02:00
a770c4bcca
Update CHANGELOG 2022-05-11 23:08:26 +02:00
f648a6e698
Update submodule 2022-05-11 22:31:06 +02:00
a72a12b96d
Test that --isolate --force bevaves well 2022-05-11 22:30:55 +02:00
591c54b5f7
Update CHANGELOG 2022-05-11 20:42:48 +02:00
a6a54f34cf
Merge branch 'issue-360' 2022-05-11 20:35:56 +02:00
f7811961b5
Merge branch 'isolateDir' 2022-05-11 20:35:38 +02:00
ee778e1177
Print bindir 2022-05-11 20:13:24 +02:00
5787a662ed
Add a --quick switch to 'ghcup run'
Also fixes #360, because we resolve all tags/versions now
by default.
2022-05-11 20:11:35 +02:00
fce654f3c7
Update CHANGELOG 2022-05-11 16:21:37 +02:00
0f052c3465
Merge branch 'reenable-upgrade' 2022-05-11 16:20:28 +02:00
c733810fdc
Bump version to 0.1.17.8 2022-05-11 16:19:34 +02:00
5130cb013b
Fix HLS not cleaning up after failed install, fix #361 2022-05-11 16:18:35 +02:00
991e540c11
Refactor code around isolateDirs, so we have proper knowledge 2022-05-11 16:18:35 +02:00
a34d9b7b89
Fix type in bootstrap-haskell.ps1 2022-05-09 12:41:54 +02:00
4e62f559fa
Update stackage resolver 2022-05-09 12:40:42 +02:00
8c3d2b6740
Merge branch 'improve-pwsh' 2022-05-04 16:05:00 +02:00
b6779f4d75
Improve welcome message in powershell installer
And warn about antivirus, fixes #343
2022-05-04 14:45:05 +02:00
b036c9861f
Re-enable upgrade functionality for all configurations
Adds a --fail-if-shadowed switch.
2022-05-04 14:15:17 +02:00
02cd773c2a
Update supported tools table 2022-05-03 11:40:05 +02:00
3964d06f5d
Merge remote-tracking branch 'origin/merge-requests/249' 2022-05-02 19:06:48 +02:00
Nick Suchecki
e83612a06c Fix typo in compile hls --help subcommand. 2022-05-01 15:12:39 +00:00
cf6c666b59
Add credits to first step guide 2022-04-30 12:50:34 +02:00
ee0ec370c7
Add playground link 2022-04-29 18:55:45 +02:00
ea0e35ddf0
Merge branch 'issue-353' 2022-04-29 16:47:37 +02:00
99c8501d47
Silence hlint 2022-04-29 16:47:11 +02:00
f8a1fed1f2
Fix parsing of symlinks with multiple slashes,
Fixes #353
2022-04-29 19:22:16 +08:00
9ad1f7cb97
Update changelog 2022-04-21 23:38:58 +02:00
0856a96738
Bump ghcup in bootstrap-script 2022-04-21 23:02:30 +02:00
ee9801a8c2
Add GHCUP_BASE_URL env var for bootstrap-haskell 2022-04-18 13:22:20 +02:00
cfecc11b43
Bump version to 0.1.17.7 2022-04-16 06:42:01 +02:00
3d36348563
Merge branch 'issue-345' 2022-04-16 06:40:08 +02:00
dcbee9c7dc
Fix tests 2022-04-15 23:01:34 +02:00
2d88b1197e
Fix EXDEV handler on windows wrt #345 2022-04-15 23:01:33 +02:00
6c12dc0d6f
Overhaul user guide 2022-04-07 20:55:45 +02:00
a4b69f29dc
Update first steps guide link 2022-04-02 23:36:16 +02:00
1680c5c448
Improvements 2022-04-02 23:31:35 +02:00
e74fb45680
Small mkdocs improvements 2022-04-02 20:11:09 +02:00
d19ab05a11
Add First steps guide initially by soupi
https://github.com/haskell-infra/www.haskell.org/pull/88
2022-04-02 19:45:50 +02:00
433c73b23c
Update CHANGELOG 2022-03-18 23:26:15 +01:00
2aa5211886
Bump version in bootstrap-haskell 2022-03-18 23:25:49 +01:00
81e7c02807
Update docs 2022-03-18 18:45:29 +01:00
a2373f2056
Improve bootstrap-haskell and fix shellcheck warnings 2022-03-18 18:24:50 +01:00
ba8e4f6ac6
Update changelog 2022-03-18 17:50:36 +01:00
76acc9a5f5
Merge branch 'max_path' 2022-03-18 17:48:58 +01:00
92bd333552
Fix double appstate 2022-03-18 17:47:49 +01:00
70a451b63e
Prepare 0.1.17.6 2022-03-18 17:47:49 +01:00
cfe6c47cd7
Fix max path issues on windows with 'ghcup run' 2022-03-18 17:47:49 +01:00
8eeb32c495
Overhaul metadata merging and add 'ghcup config add-release-channel URI' 2022-03-18 17:47:49 +01:00
fdcd6822c4
Don't do update check on --no-verbose 2022-03-18 17:47:49 +01:00
71390c84da
Apply hlint 2022-03-18 17:47:48 +01:00
84d01b1091
Don't do padding for --raw-format 2022-03-18 17:47:40 +01:00
8f9faaa39e
Fix appending on profile file if there's no trailing newline
Fixes #333
2022-03-18 17:33:08 +01:00
0898244b2a
Preserve symlinks when sedding profile file
Fixes #332
2022-03-18 17:32:37 +01:00
0c70feb09c
Fix rather humongous bug in 'ghcup list' 2022-03-17 20:04:59 +01:00
f9a38e616d
Add --raw-format to 'tool-requirements' subcommand 2022-03-17 15:05:18 +01:00
e511fc3c0a
Fix predictable /tmp dirs so ghcup gc -t fires 2022-03-16 23:15:09 +01:00
3ff670134c
FREEZE! 2022-03-15 22:51:35 +01:00
4c0160bb28
Merge branch 'issue-330' 2022-03-14 11:49:40 +01:00
c1e0baedd3
Merge branch 'issue-329' 2022-03-14 11:49:33 +01:00
8f7d937e26
Use predictable /tmp names for ghcup run, fixes #329 2022-03-14 00:38:57 +01:00
604a6fc92b
Fix bug with isolated installation of not previously installed versions
It would error out trying to set the version.
2022-03-14 00:36:08 +01:00
8c205fd18c
Add --no-set to install commands, fixes #330
This also slightly changes the default for
'ghcup install cabal/stack/hls'... instead of
only setting the installed version if it's the latest,
we always set it. So the default is `--set`.

For GHC, the default is `--no-set`.
2022-03-13 22:48:45 +01:00
41ecf897fb
Update stack.yaml 2022-03-09 20:33:45 +01:00
4c9c6e9223
Update cabal bounds 2022-03-09 19:52:16 +01:00
8be71c4c5c
Fix color 2022-03-08 22:25:34 +01:00
01d310e630
Add tool version tables 2022-03-08 22:23:29 +01:00
96cb99e1b5
Improve --repository completion 2022-03-07 22:23:39 +01:00
2e08efeed7
Adjust colors 2022-03-07 21:37:04 +01:00
04fceb3134
Update changelog 2022-03-06 12:37:17 +01:00
1f0a891bab
Fix 'ghcup install cabal/hls/stack --set' wrt #324 2022-03-05 20:50:58 +01:00
6c63a65983
Fix bad error message wrt #323 2022-03-05 20:19:54 +01:00
199d3b7aee
Fix downloader completer 2022-03-05 20:14:10 +01:00
04fc04f586
More improvements to completers 2022-03-05 20:00:32 +01:00
3f96a6460a
Merge branch 'url-completer' 2022-03-05 13:49:12 +01:00
bfcaa7f6fb
Update ghcup-metadata 2022-03-05 12:56:38 +01:00
e2bd4c4880
Update stack resolver 2022-03-05 12:56:29 +01:00
ab702bba9b
Improve completion support 2022-03-05 12:56:19 +01:00
8afabf3ffb
Update guide wrt with_hls wrapper 2022-02-26 20:17:02 +01:00
ebf6c60a10
Fix changelog link 2022-02-26 19:11:49 +01:00
9a8291d391
Fix disable-upgrade flag description 2022-02-26 19:02:37 +01:00
a6426901c5
Update dev.md 2022-02-26 18:50:58 +01:00
3b7dd36aa6
Merge branch 'ghcup-0.1.17.5' 2022-02-26 18:49:26 +01:00
dc635a6601
Finalize release 2022-02-26 18:47:18 +01:00
08ec1bd923
Update release scripts 2022-02-26 18:06:41 +01:00
b78aab884e
Prepare 0.1.17.5 release 2022-02-26 15:57:44 +01:00
36e192ec32
Refreeze 2022-02-26 15:57:43 +01:00
510675622b
Prepare 0.1.17.5 release 2022-02-26 15:33:44 +01:00
651722b935
Fix all rtd links to stable 2022-02-25 16:06:05 +01:00
7a0d5a95c1
Update cabal rtd link 2022-02-25 13:50:10 +01:00
2c583bcae9
Fix NoAdjustCabalConfig on windows 2022-02-21 16:39:25 +01:00
ab36d4418e
Update stackage to 18.25 2022-02-19 23:19:12 +01:00
f146c77797
Update CHANGELOG 2022-02-18 19:58:13 +01:00
d863ac570b
Merge branch 'windows-fix-whitespace' 2022-02-13 21:17:37 +01:00
d05fad49a1
Fix installation with whitespaces in username, fixes #314 2022-02-13 21:11:48 +01:00
fbbc4497ca
Merge remote-tracking branch 'origin/merge-requests/239' 2022-02-12 13:57:18 +01:00
4223586e62
Merge branch 'issue-137' 2022-02-12 11:46:41 +01:00
c859b3ee2b
Exclude FreeBSD from 'ghcup run' test 2022-02-11 19:24:39 +01:00
8a16b0de7c
Fix tests 2022-02-11 18:51:16 +01:00
9faf17634b
Fix hlint and windows build 2022-02-10 21:49:19 +01:00
66a62c170c
Fix 'ghcup run' for legacy HLS 2022-02-10 20:35:09 +01:00
5186d959bc
Avoid metadata download when possible 2022-02-10 19:29:32 +01:00
09a8a0bda0
Fix build on windows and stack 2022-02-10 18:35:25 +01:00
191f49adfc
Add 'ghcup run' test 2022-02-10 18:31:38 +01:00
MorrowM
26b79c5763 Update site description 2022-02-09 22:25:19 +00:00
c72841ca58
Implement 'ghcup run' 2022-02-09 18:57:59 +01:00
63350dab71
Fix recyclePathForcibly on windows 2022-02-06 22:56:22 +01:00
d110d20879
Fix HLS removal on windows 2022-02-06 22:25:23 +01:00
b4e58478c3
Fix error handling for HLS make 2022-02-06 22:24:52 +01:00
12d2acd7fd
Bump version to 0.1.17.5 2022-02-06 20:54:16 +01:00
6073ebe476
Fix HLS support and compile errors with boot and TH files 2022-02-06 00:32:18 +01:00
5c026591cb
Merge branch 'hls-dynamic-builds' 2022-02-05 21:25:21 +01:00
907365ddff
Fix FreeBSD CI 2022-02-05 19:43:24 +01:00
684953464b
Silence hlint 2022-02-05 19:39:00 +01:00
6b978b42bc
Improve rmHLSNoGHC 2022-02-05 19:12:13 +01:00
6831337289
Refactoring and fixes 2022-02-05 19:11:56 +01:00
e40777a5d3
Resolve paths when using XDG dirs, fixes #311 2022-02-05 16:48:20 +01:00
51690d1df3
Support HLS dynamic builds 2022-02-05 16:33:05 +01:00
72a06e964c
Update supported platform notes 2022-02-03 15:39:11 +01:00
9ffd402481
Add kowainik Haskell course to First steps 2022-02-03 15:21:41 +01:00
dee8d4bc09
Add symlink ftp script 2022-01-31 21:18:24 +01:00
6c57661797
Update docs wrt CI 2022-01-30 18:24:42 +01:00
b9ff7c5af4
Merge branch 'issue-291' 2022-01-30 18:22:55 +01:00
072161ada2
Don't fail to set ghc version if already installed
Fixes #291
2022-01-30 17:59:27 +01:00
a67b3e8a57
Merge branch 'improve-hls-compile-help' 2022-01-29 20:37:32 +01:00
c9216fb444
Improve help output of hls compile 2022-01-29 20:02:33 +01:00
2aac17ac5f
Merge branch 'issue-305' 2022-01-28 23:47:36 +01:00
17a403b8ce
Merge branch 'issue-307' 2022-01-28 23:20:16 +01:00
b245c11b1d
Allow to disable self-upgrade functionality wrt #305 2022-01-28 23:08:35 +01:00
2ed047515e
Merge remote-tracking branch 'origin/merge-requests/232' 2022-01-28 22:51:22 +01:00
b16e561384
Allow unpacking legacy lzma archives, fixes #307 2022-01-28 22:48:23 +01:00
Phil Ruffwind
2ebff1e887 Fix the indentation in env files
This changes the indentation from tabs to spaces, since tabs get
stripped by the heredoc.
2022-01-26 01:15:06 -08:00
655ee432f8
Merge remote-tracking branch 'origin/merge-requests/231' 2022-01-19 17:03:29 +01:00
67b7b2f292
Don't print to stdout during logging 2022-01-19 15:40:58 +01:00
66961101c6
Add documentation about mirrors, fixes #300 2022-01-19 13:04:00 +01:00
326af49a8f
Merge remote-tracking branch 'origin/merge-requests/229' 2022-01-17 21:15:30 +01:00
3a7ed5ee2d
Fix hlint warnings 2022-01-12 22:55:00 +01:00
56fa798406
Merge remote-tracking branch 'origin/merge-requests/230' 2022-01-12 22:34:46 +01:00
James Hobson
3fd9fae66a
Changed to use IO Exceptions 2022-01-12 13:31:10 +01:00
James Hobson
5d43168370
Updated help message for ghcup compile ghc -h 2022-01-12 10:06:38 +01:00
James Hobson
f8548fefb3
Added support for quilt series files when patching 2022-01-12 10:01:48 +01:00
Phil Ruffwind
3565c32d51 Avoid adding duplicates to PATH
Without this, each time the env script gets executed it will add a copy
of the paths to PATH. This can happen when shells are nested.

The "case" trick was inspired by:
184a899f45/src/cli/self_update/env.sh
2022-01-08 00:34:16 -08:00
7fab328acc
Document versions and tags better 2022-01-06 15:54:27 +08:00
a043b82b27
Fix docs 2021-12-06 20:00:41 +01:00
20652fed94
Fix comments in bootstrap-haskell.ps1 2021-12-06 20:00:17 +01:00
6fc52a4ec7
Merge branch 'freebsd1333' 2021-12-02 17:49:19 +01:00
834bcfa02c
Use FreeBSD 13 in bootstrap script as well 2021-12-02 17:48:56 +01:00
c99ecc0a66
Fix FreeBSD 13 build 2021-12-02 17:48:33 +01:00
061e5dd832
Fix FreeBSD 13 build 2021-12-02 15:53:06 +01:00
c97ade81fa
Revert "Fix arch detection on macos"
This reverts commit dbadcf1858.
2021-12-01 20:54:44 +01:00
82a22fe993
Merge branch 'darwin-arch' 2021-12-01 20:39:05 +01:00
dbadcf1858
Fix arch detection on macos 2021-12-01 20:27:03 +01:00
ff8865c5c3
Fix bootstrap on FreeBSD 2021-11-30 22:40:18 +01:00
9833dee925
Fix freebsd bootstrap 2021-11-30 21:35:33 +01:00
aac2874f8f
Fix boostrap-haskell on FreeBSD 13 2021-11-30 19:00:33 +01:00
17524b21b3
Merge branch 'issue-289' 2021-11-22 23:18:52 +01:00
3f0befe30d
Fix ghcup whereis ghc for non-standard versions, fixes #289 2021-11-22 22:53:59 +01:00
76c286f95e
Use upstream terminal-size 2021-11-22 22:51:58 +01:00
0c415314b6
Bump GHC version in bootstrap-haskell 2021-11-16 20:11:32 +01:00
717f386077
Merge branch 'issue-285' 2021-11-14 17:52:08 +01:00
7a841a480b
Run cabal update with --ignore-project, fixes #285 2021-11-14 17:49:59 +01:00
43ea85b495
Also fix redundant upgrade warnings for 'ghcup upgrade' 2021-11-14 16:24:13 +01:00
8a6badca1d
Update changelog 2021-11-14 14:03:06 +01:00
4064803e23
Merge branch 'issue-283' 2021-11-14 00:23:07 +01:00
2e03b075f8
Avoid redundant warnings when installing tools, fixes #283 2021-11-13 22:59:52 +01:00
fe9c125bd6
Refreeze 2021-11-13 22:53:39 +01:00
503fd57d7c
Merge branch 'issue-282' 2021-11-13 20:42:13 +01:00
e74e746213
Trim whitespaces wrt #282 2021-11-13 20:35:50 +01:00
065f9c4965
Fix compile HLS CI 2021-11-13 16:56:38 +01:00
32f3c36589
Set HOMEBREW_TEMP to something shorter
This fixes unix socket errors, because there's a max path length for
those.
2021-11-13 16:53:31 +01:00
c2a8d39fb4
Bump to 0.1.17.4 2021-11-12 20:52:08 +01:00
f08cbe70fb
Merge branch 'issue-281' 2021-11-12 20:42:43 +01:00
a9630d0802
Cooler patching 2021-11-12 19:52:00 +01:00
c5c6c431b5
Allow remote URIs for --cabal-project-local wrt #281 2021-11-12 19:05:13 +01:00
71d78d2d72
Update cabal.project 2021-11-12 19:04:46 +01:00
ccecda2eff
Merge branch 'dynamic-hls' 2021-11-12 17:57:15 +01:00
3a5f8d6139
Fix build on windows 2021-11-12 15:01:24 +01:00
74e0f39bc2
Fix stack.yaml 2021-11-12 01:28:40 +01:00
274978a8a7
Allow to pass cabal args to 'compile hls'
This breaks the existing cli interface, but whatever.
2021-11-12 01:13:57 +01:00
8eea9bd6a5
Prefer forM_ when possible 2021-11-12 01:04:27 +01:00
626a2dd020
More debug logging 2021-11-12 01:01:21 +01:00
6b6ce221e0
Use patched haskus-utils-variant, fixing applicative instance 2021-11-12 00:57:39 +01:00
d038c361c0
Revert "Fix HLS rebuilds"
This reverts commit 8e8198546f.
2021-11-11 21:40:02 +01:00
c05876cc60
Fix build with ghc-8.6.5 2021-11-02 19:53:22 +01:00
b9c4c9a0b7
Fix hlint 2021-11-02 10:57:27 +01:00
6697e804ee
Merge branch 'fix-ghc-version-parser' 2021-11-02 10:56:21 +01:00
2c57def8f1
Fix parsing of atypical ghc versions 2021-11-02 01:22:06 +01:00
62b16e957b
Merge branch 'issue-276' 2021-10-30 14:17:52 +02:00
18d7bdd85c
Merge branch 'issue-278' 2021-10-30 14:17:11 +02:00
190b5dedba
Allow to control the metadata cache, fixes #278 2021-10-30 14:16:45 +02:00
886e45f788
Update hie.yaml 2021-10-30 13:47:45 +02:00
360daf2a09
Make upgrading ghcup in TUI more pleasant 2021-10-30 12:54:05 +02:00
7bb67dd4c6
Merge branch 'ghcup-gen' 2021-10-27 15:55:51 +02:00
72c4ea70c4
Migrate ghcup-gen to haskell/ghcup-metadata 2021-10-27 15:33:39 +02:00
0ae42dd71e
Refreeze 2021-10-27 14:47:49 +02:00
1df1e7eb98
Add links to metadata yaml files 2021-10-27 14:43:10 +02:00
9592021c48
Bump version in bootstrap script 2021-10-27 14:28:32 +02:00
9a9c3b340e
Remove metadata from ghcup.cabal 2021-10-27 14:02:13 +02:00
abd64cb3fa
Disable darwin M1 jobs by default 2021-10-27 13:58:10 +02:00
b366a50af1
Force Cabal 3.6.2.0 2021-10-27 13:13:35 +02:00
e4b9eeefc6
Update GHC/cabal on github CI 2021-10-27 12:18:12 +02:00
4d7a8557eb
Fix yaml format 2021-10-27 12:09:07 +02:00
c23357df81
Only clone when necessary 2021-10-27 12:06:24 +02:00
f728d5aa23
Revert bootstrap-haskell 2021-10-27 12:04:53 +02:00
ac59563adf
Release 0.1.17.3 2021-10-27 11:56:18 +02:00
b2d2996077
Merge branch 'fix-nix' 2021-10-27 11:48:28 +02:00
df2337abf9
Get rid of nix and use homebrew, fixes #274 2021-10-27 11:48:06 +02:00
d68ab3b657
Merge branch 'github-metadata' 2021-10-25 22:20:33 +02:00
c10821c332
Use github.com/haskell/ghcup-metadata 2021-10-25 21:47:42 +02:00
219cba5fc7
Fix arm-ness 2021-10-25 21:01:19 +02:00
8e3c74958a
Update cabal constraint 2021-10-24 14:22:39 +02:00
ed08e0b166
Use aeson-pretty from hackage 2021-10-24 13:51:23 +02:00
168f2e6d16
Merge branch 'improve-config' 2021-10-22 09:35:46 +02:00
4574f3aa4f
Switch to yaml-streamly 2021-10-21 23:39:07 +02:00
2a11e85a95
Allow to specify config value as JSON 2021-10-19 20:46:38 +02:00
69df100b18
Update module graphs 2021-10-17 21:17:14 +02:00
920b027a32
Merge branch 'reduce-win-cpp' 2021-10-17 21:16:59 +02:00
9f8c9c228d
Reduce IS_WINDOWS CPP 2021-10-17 20:57:22 +02:00
9d8fdfe090
Merge branch 'refactor-main' 2021-10-17 19:46:20 +02:00
01956d694d
Refactor app Main 2021-10-17 19:15:24 +02:00
09d2a1e815
Merge branch 'issue-266' 2021-10-13 22:09:18 +02:00
ccfaedb7ad
Migrate to aeson-2.0.1.0 2021-10-13 19:47:14 +02:00
356a69f575
Merge branch 'issue-267' 2021-10-13 19:35:36 +02:00
752efad4bf
Fix desktop shortcut creation 2021-10-13 19:19:52 +02:00
05adb224e9
Improve "How to help" 2021-10-13 18:17:46 +02:00
bf1a3fbbe8
Merge branch 'improve-page-take-2' 2021-10-13 18:11:41 +02:00
8b14b22b12
Merge branch 'improve-page-take-3' 2021-10-13 18:11:34 +02:00
b8b47a45ba
Remove Prev/Next buttons 2021-10-13 16:15:43 +02:00
2b9e51cc31
Remove issue tracker button 2021-10-13 16:15:30 +02:00
d9fa0cdb45
Try to match color and width of hackage navbar 2021-10-13 16:15:09 +02:00
288af4abc6
Add first-steps link to bootstrap-haskell 2021-10-13 15:09:09 +02:00
e77b2c39f9
Add "how to help" section 2021-10-13 15:07:45 +02:00
87e5d526cb
Move GPG verification to the bottom 2021-10-13 15:07:45 +02:00
2b33dd4871
Add uninstallation section 2021-10-13 15:07:45 +02:00
62b68cfa3e
Add "first steps" section 2021-10-13 15:07:44 +02:00
Arjun Kathuria
af14227862 move need-help section above, refactor its html. move donate down 2021-10-13 16:09:31 +05:30
Arjun Kathuria
eb0e9df6ab change the website theme to a consistent purple, to match haddock's 2021-10-13 16:02:32 +05:30
f1cc2ebf20
Merge branch 'fix-adjust_cabal_config' 2021-10-12 21:19:04 +02:00
74f14c68a4
Fix path to cabal bin dir in adjust_cabal_config 2021-10-12 20:09:40 +02:00
5dc5c2094e
Merge branch 'improve-page' 2021-10-12 14:29:53 +02:00
940b5842b6
Add "Get help" section 2021-10-12 12:58:21 +02:00
d19602d06f
Reduce donate button size a bit 2021-10-12 12:54:55 +02:00
ae85f7152e
Close the link, otherwise it spans to the bottom of the page 2021-10-12 12:54:40 +02:00
Arjun Kathuria
2cb40af62f
make donate button primary call-to-action, move it above-the-fold for
better visibility, move need-help section near footer
2021-10-12 12:48:07 +02:00
Arjun Kathuria
569b46f0c4
improves the look of central download box 2021-10-12 12:47:08 +02:00
Arjun Kathuria
6b0c915077
align the top haskell logo and "GHCUP" text correctly 2021-10-12 12:47:04 +02:00
Arjun Kathuria
237ed173ee
format extra.css with 2 spaces uniformly for readability 2021-10-12 12:46:52 +02:00
c0c6cd4fb3
Fix some https links 2021-10-12 11:34:48 +02:00
1f100623a7
Link to Haskell documentation after installation 2021-10-12 11:34:48 +02:00
f137d5cc21
Bring back the original install look&feel with platform detection 2021-10-12 11:34:47 +02:00
aea8af513b
Merge branch 'better-cleanup' 2021-10-10 21:50:19 +02:00
c846e52acb
Cleanup during unpack failures as well 2021-10-10 20:48:33 +02:00
19e7f0df34
Use static cabal bindists for linux 2021-10-10 17:53:24 +02:00
cd218ce025
Merge branch 'Cabal-3.6' 2021-10-09 23:22:29 +02:00
c381f47a72
Bump GHC/cabal in CI 2021-10-09 22:49:09 +02:00
a68355cb7d
Raise Cabal lower bound 2021-10-09 22:49:09 +02:00
f53a10825e
Merge remote-tracking branch 'origin/merge-requests/196' 2021-10-09 20:30:11 +02:00
21bbb8be1c
Merge branch 'mkdocs-ci' 2021-10-09 19:47:47 +02:00
ab44e9d2ac
Add shellcheck check 2021-10-09 19:46:29 +02:00
32497f3a6f
Add mkdocs to CI 2021-10-09 19:38:07 +02:00
c06c6b6f12
Fix 32bit cabal bindists 2021-10-09 19:26:39 +02:00
26335150b7
Fix alpine hashes 2021-10-09 12:47:28 +02:00
5298aacac9
Fix cabal-3.6.2.0 hashes 2021-10-09 12:25:25 +02:00
Arjun Kathuria
7832399fb3 fix unordered-list li items overflow, esp on about page 2021-10-09 13:48:45 +05:30
Arjun Kathuria
2b60830203 fix donate button margin across mobile and desktop on homepage 2021-10-09 13:27:07 +05:30
Arjun Kathuria
b9bf29ba2c fix mobile site, cleanup some css from new homepage 2021-10-09 13:14:26 +05:30
00d67c270e
Set previous cabal versions as old 2021-10-09 01:38:06 +02:00
2826fec975
Bump cabal 2021-10-09 01:33:34 +02:00
29a34f5edf
Add sponsors to about 2021-10-08 21:05:14 +02:00
c100daeba5
Redo landing page 2021-10-06 19:09:44 +02:00
ac66f6747e
Fix description of macos versions
Fixes #261
2021-10-06 17:27:47 +02:00
014f1ff125
Improve documentation 2021-10-06 10:20:08 +02:00
c4991425ab
Add modgraph script 2021-10-05 21:38:07 +02:00
1c770aad58
Add module graph 2021-10-05 21:36:50 +02:00
7c8912d48c
Set favicon 2021-10-05 20:25:47 +02:00
67d9a0bd2c
Improve about page 2021-10-05 16:57:14 +02:00
0115e2a13c
Set 3.4.0.0 as recommended, since 3.6.0.0 is broken on windows 2021-10-05 14:26:42 +02:00
e2f36611a1
Tweak appearance 2021-10-04 21:40:48 +02:00
9143ac97c5
Update README 2021-10-04 18:51:11 +02:00
b5b09d0ca2
Beef up Quick Install 2021-10-04 11:07:25 +02:00
fa79f75072
Add missing cabal-install-3.6.0.0-i386-linux.tar.gz 2021-10-03 12:42:21 +02:00
6459af419e
Merge branch 'issue-258' 2021-10-03 12:40:27 +02:00
2ff2655db0
Fix ghcup.cabal 2021-10-03 12:15:22 +02:00
c4ab59f7bf
Make sure to always ass GHC env var, fixes #258 2021-10-03 11:38:53 +02:00
a62365141e
Fix nested lists, which need 4 spaces of indent 2021-10-03 00:48:22 +02:00
5ae649bccb
Fix hover 2021-10-03 00:28:53 +02:00
2095b17d06
Fix navbar 2021-10-03 00:22:00 +02:00
336514b3e2
Add logo 2021-10-03 00:20:44 +02:00
37707e1df8
More color fixes 2021-10-03 00:19:28 +02:00
57aa30c7af
Improve colors 2021-10-03 00:14:45 +02:00
78c6dd5404
Improve image 2021-10-02 23:29:40 +02:00
c101c228d7
Improve docs and update www 2021-10-02 23:18:07 +02:00
0f6874bc0f
Update gif 2021-10-02 22:44:02 +02:00
399d89dae5
Fix doc links 2021-10-02 22:37:17 +02:00
ba6b540869
Lower badge size 2021-10-02 22:31:44 +02:00
249c5a5c59
Fix buttons 2021-10-02 22:28:54 +02:00
e2c59230b5
Fix button size 2021-10-02 22:27:49 +02:00
1d1ace096e
Update docs 2021-10-02 22:26:35 +02:00
0381ccef64
Update README 2021-10-02 22:00:07 +02:00
e5a0f836a4
Fix padding 2021-10-02 21:54:34 +02:00
463915da1a
Improve css selectors due to mkdocs version mismatch 2021-10-02 21:48:24 +02:00
ae7bc508e8
Add meta extension 2021-10-02 21:39:22 +02:00
d21e0473bc
Hide navbar for home 2021-10-02 21:36:15 +02:00
df05feb766
Merge branch 'readthedocs' 2021-10-02 21:20:58 +02:00
e0dafa2093
Add readthedocs via mkdocs 2021-10-02 21:19:37 +02:00
f1e01e8b18
Add golden file to extra-source-files wrt #255 2021-10-02 14:31:38 +02:00
8a770de33e
Merge branch 'issue-252' 2021-10-01 20:52:00 +02:00
b3aeb3246f
Fix homepage on chrome/brave 2021-10-01 20:51:37 +02:00
1fc3e0ee5d
Refreeze 2021-10-01 20:29:24 +02:00
f2dcfbdc5f
Prepare for hackage release 2021-10-01 17:15:30 +02:00
23d77ce1b4
Update metadata 2021-09-30 15:43:22 +02:00
0e6688c2bc
Bump to 0.1.17.2 2021-09-30 11:15:53 +02:00
7ef1ef688f
Merge branch 'issue-253' 2021-09-29 23:58:56 +02:00
3b8f2e8307
Apply patches before bootstrap 2021-09-29 23:08:55 +02:00
0af7aaef3c
Fix `--overwrite-version for ghcup compile ghc
Fixes #253
2021-09-29 22:33:17 +02:00
b8907335ba
Merge remote-tracking branch 'origin/merge-requests/192' 2021-09-29 19:08:04 +02:00
0073ca769b
Add darwin aarch64 bindist for 9.2.0.20210821 2021-09-29 15:23:40 +02:00
8a286156f6
Improve information regarding what the scripts do 2021-09-29 11:37:16 +02:00
5a39ead523
Speed up unset command 2021-09-27 12:52:45 +02:00
d2b4eccac2
Honour GHC bootstrap compiler during git clone stages
Fixes #250
2021-09-27 12:51:59 +02:00
be9b3a3857
Mark some more GHC versions as old 2021-09-26 20:27:50 +02:00
a8e6fca128
Set cabal-3.6.0.0 as recommended 2021-09-26 20:24:41 +02:00
0483133857
Bump metadata 2021-09-26 16:58:35 +02:00
30d9eb5634
Bump to 0.1.17.1 2021-09-26 15:02:08 +02:00
9fe7af3335
Hide nuclear command 2021-09-25 22:45:06 +02:00
bedfb3d114
Merge branch 'issue-241' 2021-09-25 22:44:59 +02:00
c19dd5ee8b
Implement ghcup gc command
Fixes #241
2021-09-25 22:29:02 +02:00
6ae3bfe395
Merge branch 'fix-hls-build' 2021-09-25 19:21:19 +02:00
4f82e80dad
Merge branch 'issue-243' 2021-09-25 18:29:10 +02:00
8e8198546f
Fix HLS rebuilds 2021-09-25 18:25:03 +02:00
9497e310ca
Improve cli interface with partial versions
Fixes #243
2021-09-25 17:13:11 +02:00
02135bdbae
Merge branch 'freebsd12' 2021-09-25 00:21:08 +02:00
041a341879
Merge branch 'issue-242' 2021-09-25 00:19:51 +02:00
15dd810d67
Get rid of concurrent-output
Also improve some NO_COLOR foo.
2021-09-24 23:49:50 +02:00
7982f3aec0
Merge branch 'issue-244' 2021-09-24 23:19:35 +02:00
2fb07201c7
Fix freebsd12 tag 2021-09-24 20:54:55 +02:00
b5ca01dc4f
Merge branch 'issue-248' 2021-09-24 20:52:41 +02:00
fa523d590e
Add ListAvailable to ListCriteria 2021-09-24 20:51:29 +02:00
523f2f57e1
Fix ghcup list -t for hls/stack, fixes #244 2021-09-24 20:51:29 +02:00
d662682fb5
Honour NO_COLOR in bootstrap scrips, fixes #248 2021-09-24 20:37:55 +02:00
ff2b06a5e8
Merge branch 'no-color' 2021-09-23 23:28:04 +02:00
aece305003
Move logger stuff to logger module 2021-09-23 12:53:01 +02:00
ef8da9bcec
Make sure NO_COLOR also applies to logging 2021-09-23 12:16:49 +02:00
3cd55beab1
Metadata bump 2021-09-21 12:24:24 +02:00
6766501858
Merge branch 'hls-compile-improve' 2021-09-20 23:27:15 +02:00
d5b41683ca
Improve HLS compile 2021-09-20 22:24:20 +02:00
ff8dbe111d
Fix spelling 2021-09-20 20:01:24 +02:00
28d4071fac
Bump version 2021-09-20 19:55:11 +02:00
31a523755f
Remove solus support 2021-09-20 19:42:06 +02:00
3d1d8f1af7
Improve optparse hls stuff 2021-09-20 14:43:43 +02:00
167f6d0683
Merge branch 'freebsd-ci' 2021-09-20 12:09:54 +02:00
8580487b61
Add retries 2021-09-20 11:30:58 +02:00
a8b1c33280
Add FreeBSD12 CI back 2021-09-20 11:25:40 +02:00
fca2a4134b
Merge branch 'hls-compile' 2021-09-19 22:38:51 +02:00
f90741f4d3
Implement compiling HLS from source 2021-09-19 22:04:32 +02:00
ba4b45f7fb
Merge branch 'unset' 2021-09-19 16:25:30 +02:00
4767f3db5b
Implement ghcup unset 2021-09-19 14:17:55 +02:00
709658462c
Merge branch 'gpg' 2021-09-19 12:28:46 +02:00
c431c0ae00
Implement GPG verification wrt #236 2021-09-18 21:51:19 +02:00
6f61b5dbef
Make hlint shut up 2021-09-18 15:47:54 +02:00
c42c4b64f9
Improve logging 2021-09-18 15:46:53 +02:00
d3a36c2c9a
Merge remote-tracking branch 'origin/merge-requests/156' 2021-09-18 15:19:06 +02:00
6799e9616e
Merge remote-tracking branch 'origin/merge-requests/177' 2021-09-17 22:14:33 +02:00
Emily Pillmore
e8d962ac44 Add language fixes per issue #237 2021-09-17 14:11:00 -06:00
ac1e145028
Update README 2021-09-17 12:00:07 +02:00
2fdf121167
Update readme 2021-09-17 11:54:43 +02:00
dcca8b0bf2
Merge branch 'issue-231' 2021-09-17 11:51:33 +02:00
b1f891b005
Add supported platforms to README 2021-09-17 11:50:26 +02:00
648dcc7287
Update HLS 2021-09-16 21:41:05 +02:00
2175f7dd3d
Warn when installing 8.10.5/8.10.6 2021-09-16 16:01:51 +02:00
aff90a52f1
Merge branch 'hls-1.4.0' 2021-09-15 23:08:48 +02:00
0f14dee72a
Bump HLS to 1.4.0 2021-09-15 22:41:57 +02:00
ae2031174e
Improve warnAboutHlsCompatibility 2021-09-14 12:36:14 +02:00
c163278c64
Merge remote-tracking branch 'origin/merge-requests/172' 2021-09-14 12:26:41 +02:00
d10133f06f
Clean up toolRequirements 2021-09-13 22:33:46 +02:00
4377fc663e
Merge branch 'opencollective' 2021-09-13 08:43:10 +02:00
487e236882
Add opencollective button 2021-09-13 08:34:13 +02:00
Arjun Kathuria
8fc128e89b move some code around for better consistency 2021-09-12 09:25:09 +05:30
Chris Smith
737f72f90f Lint fix. 2021-09-11 23:35:39 -04:00
Chris Smith
c3aab65521 Rewording 2021-09-11 23:24:21 -04:00
Chris Smith
972474f79a Add version numbers to error message.
Fixes after formatting changes.
2021-09-11 23:17:14 -04:00
bc64d2ade0 Apply 3 suggestion(s) to 1 file(s) 2021-09-12 03:09:36 +00:00
Chris Smith
eddda55fe6 Fix hlint warnings 2021-09-11 19:57:42 -04:00
Chris Smith
13aca91231 Add a warning when the installed HLS and GHC versions are not compatible.
This is triggered when:

1. The user has just set either the GHC or HLS version.
2. There is an HLS version set (so some GHC version is compatible).
3. There is a GHC version.
4. The HLS version doesn't support that GHC version.

Fixes #234
2021-09-11 19:33:27 -04:00
Arjun Kathuria
6011242eae minor cleanup 2021-09-11 23:23:58 +05:30
Arjun Kathuria
cadb5086e1 Implements --force install for GHC 2021-09-11 23:20:06 +05:30
Arjun Kathuria
10a30bbf38 Implements --force install for Stack 2021-09-11 22:04:54 +05:30
Arjun Kathuria
6ac7a75bab Implements --force install for HLS 2021-09-11 22:04:40 +05:30
bbd11bfa26
Merge branch 'freebsd13' 2021-09-11 09:22:44 +02:00
75548fa02d
Merge branch 'improve-ci' 2021-09-10 20:59:14 +02:00
fb6956009f
Add cabal freebsd13 bindists 2021-09-10 20:58:26 +02:00
e029117c3e
Fix freebsd runner getting stuck (maybe) 2021-09-10 19:48:42 +02:00
bc7c01de90
Add aarch64-darwin and armv7-linux cabal-3.6.0.0 bindists 2021-09-10 19:07:07 +02:00
cfcd8a4c20
Merge remote-tracking branch 'origin/merge-requests/170' 2021-09-10 18:29:37 +02:00
5e17eb7ca7
Bump FreeBSD runner 2021-09-10 15:46:19 +02:00
amesgen
756727ffe2
Add cabal 3.6.0.0 2021-09-10 15:40:42 +02:00
6bc602dead
Merge branch 'fix-boot' 2021-09-10 15:15:59 +02:00
056c79e813
Improve CI 2021-09-10 15:14:40 +02:00
68bbf31a86
Fix download for armv7 container on arm64 host 2021-09-10 14:59:26 +02:00
b58f380e75
Merge branch 'bootstrap' 2021-09-10 13:55:55 +02:00
48c54bf374
Don't unconditionally adjust .bashrc on windows 2021-09-10 13:34:22 +02:00
51da1578f4
Merge remote-tracking branch 'origin/merge-requests/166' 2021-09-08 22:16:02 +02:00
jneira
488f25aed6 Include stack and minor correction 2021-09-08 14:14:05 +02:00
Arjun Kathuria
d60f58cf43 simplify checkIfToolInstalled for Cabal 2021-09-07 14:22:21 +05:30
Arjun Kathuria
7a6a119829 Patch for MonadLogger deletion since new rebase 2021-09-07 14:21:24 +05:30
Arjun Kathuria
f0fb019c70 Merge branch 'feat-force' of gitlab.haskell.org:arjun/ghcup-hs into feat-force 2021-09-07 11:29:33 +05:30
Arjun Kathuria
0f98ec6b78 factor out checkIfCabalInstalled to checkIfToolInstalled 2021-09-07 11:24:28 +05:30
Arjun Kathuria
107fed6e60 refactor nested case statements when installing cabal 2021-09-07 11:23:30 +05:30
Arjun Kathuria
59a9a770a5 implements --force option for cabal installs. 2021-09-07 11:23:26 +05:30
Arjun Kathuria
20bcb26e3d Adds the --force option in install commands 2021-09-07 11:17:10 +05:30
d355c46250
Merge branch 'issue-228' 2021-09-07 00:05:30 +02:00
787c927de6
Improve logging, fixes #228 2021-09-06 23:01:49 +02:00
d15ff7bc67
Improve README 2021-09-05 22:43:44 +02:00
7c5c35f1b0
Fix typo 2021-09-05 22:23:08 +02:00
001b090bc6
Merge branch 'ghc-compile-patch' 2021-09-05 22:21:42 +02:00
db8207f8b9
Fixup 2021-09-04 16:06:33 +02:00
e5918de7af
Update README 2021-09-04 15:59:14 +02:00
d2346a543a
Fixup 2021-09-04 15:53:29 +02:00
c057b4ae5c
Improve documentation about building 2021-09-04 15:14:32 +02:00
b962bf4af9
Add missing qAddDependentFiles 2021-09-04 15:10:07 +02:00
c54dc05d92
Read build.mk from files at build time 2021-09-04 15:09:14 +02:00
8c72bf697e
Move files into nicer subdirectories 2021-09-04 15:08:58 +02:00
cc8cf3d12a
Improve --patchdir documentation wrt #226 2021-09-04 14:31:05 +02:00
9bdf6bde17
Only consider .diff/.patch for patch files wrt #226 2021-09-04 14:25:24 +02:00
8363495843
Update known users 2021-09-03 23:58:28 +02:00
bc80b1048f
Fix debug logs 2021-09-03 21:00:39 +02:00
d61981bc1b
Update doc on ghcupURL 2021-09-02 21:27:31 +02:00
4ccdc5dd6c
Update RELEASING.md 2021-09-02 21:23:37 +02:00
3240118226
Simplify CI section 2021-09-02 21:11:13 +02:00
254989d63d
Merge branch 'issue-221' 2021-09-02 16:22:38 +02:00
283f2a6e46
Add ghcup whereis bindir and friends, fixes #221 2021-09-02 15:37:03 +02:00
94637dfbab
Merge branch 'updates' 2021-09-01 01:00:20 +02:00
3e26d7057c
Update ghc file 2021-09-01 00:44:52 +02:00
3f710112f3
Rather do it in bootstrap-haskell 2021-08-31 23:23:59 +02:00
34df41b44a
Update debian image 2021-08-31 23:04:57 +02:00
3897434ef0
Create .bash_profile on windows if it doesn't exist 2021-08-31 22:59:32 +02:00
375dba9dd1
Improve hlint job 2021-08-31 22:59:32 +02:00
2edd1fb583
Merge branch 'fix-bootstrap-win' 2021-08-31 19:28:21 +02:00
11326060fb
Smaller fixes to windows bootstrap 2021-08-31 18:57:38 +02:00
d343c01737
Add CI section 2021-08-31 02:17:38 +02:00
3925f78721
Merge branch 'drop-monad-logger' 2021-08-30 23:55:31 +02:00
d98e54a743
Drop yaml/libyaml 2021-08-30 23:36:11 +02:00
13143b8e4d
Drop monad-logger 2021-08-30 23:36:11 +02:00
3a7895e5ea
Reorder 2021-08-30 13:59:30 +02:00
2893b2e2d2
Adjust argumentlist 2021-08-30 13:49:48 +02:00
987436fed2
Adjust switch order 2021-08-30 13:47:08 +02:00
Arjun Kathuria
be82565775 factor out checkIfCabalInstalled to checkIfToolInstalled 2021-08-30 15:20:33 +05:30
Arjun Kathuria
f8d0243146 refactor nested case statements when installing cabal 2021-08-30 15:18:43 +05:30
96ac66e909
Merge branch 'issue-222' 2021-08-30 11:42:28 +02:00
e5947f3490
Add BOOTSTRAP_HASKELL_MINIMAL wrt #222 2021-08-30 11:19:43 +02:00
b35fe15703
Merge branch 'remove-zipp' 2021-08-29 23:11:03 +02:00
a269b60282
Remove extra 2021-08-29 22:37:16 +02:00
fc6f7ffd73
Update stack.yaml 2021-08-29 21:21:03 +02:00
430dc2d20b
Remove zip dependency 2021-08-29 20:56:17 +02:00
77c464870f
Refreeze 2021-08-29 17:46:53 +02:00
dda38ec52b
Merge remote-tracking branch 'origin/merge-requests/158' 2021-08-29 17:43:01 +02:00
Jan Hrček
f6b6b36eb7 Apply hlint 3.3.2 suggestions 2021-08-29 17:08:06 +02:00
Jan Hrček
3986677b06 Fix typos and simplify code 2021-08-29 14:50:49 +02:00
1fb048777c
Merge branch 'cabal-plan' 2021-08-27 15:19:17 +02:00
e9c335eecc
Add --cabal-plan 2021-08-27 14:59:09 +02:00
a7c7186aa4
Add ghc-8.10.7 2021-08-27 12:41:01 +02:00
Arjun Kathuria
d7f82d643c implements --force option for cabal installs. 2021-08-27 13:06:18 +05:30
Arjun Kathuria
15560a06b1 Adds the --force option in install commands 2021-08-27 13:05:54 +05:30
e38bd61066
Fixup merge 2021-08-26 20:16:40 +02:00
b086261c3c
Merge remote-tracking branch 'origin/merge-requests/149' 2021-08-26 20:12:19 +02:00
8c098d4e17
Add solus in getLinuxDistro 2021-08-26 20:09:48 +02:00
e3a9c095c6
Merge branch 'remove-string-interpolate' 2021-08-25 21:17:19 +02:00
678bdd7915
Bump stack resolver 2021-08-25 19:02:17 +02:00
14fc6b7281
Remove string-interpolate wrt #212 2021-08-25 18:54:58 +02:00
a2555cecc5
Merge branch 'solus' 2021-08-25 15:11:29 +02:00
9d6e469f79
Add solus support 2021-08-25 13:51:34 +02:00
982c0a0fcf
Merge branch 'fix-CII' 2021-08-25 12:16:18 +02:00
f8cfcd4038
Get rid of tar 2021-08-25 11:48:30 +02:00
4d465efef1
Fix cabal-docspec in CI 2021-08-24 22:02:55 +02:00
d667160027
Merge remote-tracking branch 'origin/pr/6' 2021-08-24 21:19:35 +02:00
Mario Lang
df55d972cf brick-0.64 has been released 2021-08-24 21:16:41 +02:00
Arjun Kathuria
df758d828b swap checkFileAlreadyExists with throwIfFileAlreadyExists 2021-08-24 20:39:07 +05:30
7bc00c4e68
Merge branch 'issue-211' 2021-08-24 16:14:24 +02:00
bfc50e269c
Show a warning if xattr can't be executed 2021-08-24 15:34:35 +02:00
cea71beb4d
Add docspec to gitlab CI 2021-08-24 10:54:25 +02:00
8247c0b00b
Add more doctests 2021-08-24 10:51:39 +02:00
f624a83e87
Merge branch 'issue-213' 2021-08-24 10:51:10 +02:00
951e676bee
Fix header reading wrt #213 2021-08-23 23:16:32 +02:00
281f310394
Add some unit tests 2021-08-23 23:16:14 +02:00
Arjun Kathuria
8c486e8d46 Make GHCup isolate installs non-overwriting by default 2021-08-23 20:18:45 +05:30
c029713f23
Merge branch '9.2.0.20210821' 2021-08-23 13:37:44 +02:00
b86e2a1d5b
Add GHC-9.2.0.20210821 rc1 2021-08-23 13:16:18 +02:00
099a6b9dcd
Merge branch 'fixes' 2021-08-21 14:46:43 +02:00
3b13624117
Clean up CI 2021-08-21 14:34:47 +02:00
fad1efcefa
Fix wrong libffi dependency version for Debian 11 (bullseye)
Fixes #209
2021-08-21 14:28:53 +02:00
1701b8a2f4
Fix bootstrap-haskell prompts when no shell is detected 2021-08-21 14:28:31 +02:00
608ee07940
Merge remote-tracking branch 'origin/merge-requests/146' 2021-08-21 09:28:56 +02:00
Arjun Kathuria
a0c2a5ccec Adds isolated installs documentation in readme 2021-08-16 22:08:44 +05:30
cd41d3af97
Merge branch 'fix-CI' 2021-08-16 14:18:58 +02:00
b5aafdee61
Fix CI 2021-08-16 12:57:05 +02:00
9d9e4bb44e
Add GHC-8.10.6 2021-08-14 17:01:27 +02:00
c708283547
Merge branch 'issue-208' 2021-08-14 15:13:47 +02:00
a4ddf95c8d
Check for chocolatey during windows bootstrap
Fixes #208
2021-08-14 14:44:00 +02:00
ddbb396bf3
Add discord logo
Hopefully this is all legal :o
2021-08-12 18:03:33 +02:00
e2a7c320ac
Fix matrix link 2021-08-12 13:33:17 +02:00
06f998fa5e
Update README badges 2021-08-12 13:31:28 +02:00
c48c73d34d
Merge remote-tracking branch 'origin/pr/5' 2021-08-12 13:13:31 +02:00
cfb6ab31ab
Update website 2021-08-12 13:08:52 +02:00
The Gitter Badger
eac15541e8 Add Gitter badge 2021-08-12 09:28:17 +00:00
984acebff8
Fix metadata files 2021-08-12 11:12:55 +02:00
4cf2d125dd
Update metadata to 0.1.16.2 2021-08-11 20:01:37 +02:00
6701093c3b
Bump version to 0.1.16.2 2021-08-11 16:30:01 +02:00
e9fdc073c6
Fix --flavor 2021-08-11 16:19:52 +02:00
57c791106b
Fixup rest of the PR 2021-08-11 16:19:31 +02:00
fcba151fad
Merge remote-tracking branch 'origin/merge-requests/134' 2021-08-11 14:20:04 +02:00
3b24f503d1
Fixup rest of the PR 2021-08-11 13:54:02 +02:00
bd18fd9aa1
Merge remote-tracking branch 'origin/merge-requests/127' 2021-08-11 12:28:48 +02:00
Arjun Kathuria
c2c5625685 implements checking if file already exists for Cabal installs 2021-08-11 10:33:08 +05:30
Arjun Kathuria
ce6fb0bb1e Adds new Error type FileAlreadyExistsError 2021-08-11 10:28:30 +05:30
Arjun Kathuria
dcfb3afdad Revert "implements isolated install sanity-checking for Cabal installs"
This reverts commit 300cfd3ba6.
2021-08-11 09:46:42 +05:30
50c91345e8
Merge branch 'windows-autoconf' 2021-08-10 17:08:43 +02:00
af3ecae792
Install autoconf in msys2 wrt #200 2021-08-10 16:58:37 +02:00
Arjun Kathuria
300cfd3ba6 implements isolated install sanity-checking for Cabal installs 2021-08-10 20:14:46 +05:30
Arjun Kathuria
bb430fa0b7 Adds the sanity check function for isolated installs 2021-08-10 20:12:14 +05:30
Arjun Kathuria
80fa7965a4 Adds new Error type IsolatedDirNotEmpty 2021-08-10 20:11:32 +05:30
9975a2d4ba
Merge branch 'fix-install' 2021-08-10 16:39:46 +02:00
Arjun Kathuria
d1735bc446 adds toolchainSanityChecks for isolated installs too in installGHCBindist function. 2021-08-10 19:53:41 +05:30
dbf1d6f420
Fix unneeded dist files being installed along with GHC 2021-08-10 15:58:40 +02:00
0a0fbd0cb6
Merge branch 'fix-metadata-download' 2021-08-07 19:26:26 +02:00
f13f53b910
Merge branch 'throwM' 2021-08-07 19:20:00 +02:00
6dfc04a9f6
Fix metadata file read in --offline mode 2021-08-07 18:31:41 +02:00
72133d0002
Rather skip copying to cache dir if scheme is file:// 2021-08-07 10:24:08 +02:00
6e07e9e56b
Skip copying metadata if source and destination match 2021-08-07 09:55:45 +02:00
e903aeb555
Skip cached metadata when url starts with file:// 2021-08-07 09:54:26 +02:00
2792f6f4b6
Fix error handling when we can't find a filename 2021-08-06 19:45:59 +02:00
Arjun Kathuria
80eb72ce49 Merge branch 'smash-1' of gitlab.haskell.org:arjun/ghcup-hs into smash-1 2021-08-04 16:09:48 +05:30
Arjun Kathuria
2c6d0382cf adds isolate install feature to compiled ghc command 2021-08-04 16:08:12 +05:30
Arjun Kathuria
e1bec789b0 updates Bindist functions as per https://gitlab.haskell.org/haskell/ghcup-hs/-/merge_requests/127#note_366702 2021-08-03 18:08:54 +05:30
Arjun Kathuria
5683493cae rename some auxiliary functions to their "unpacked" versions 2021-08-03 18:08:54 +05:30
Arjun Kathuria
ae5e213b59 deletes installStackBinIsolated function 2021-08-03 18:08:54 +05:30
Arjun Kathuria
911089f334 updates usages of new installStackBin across files 2021-08-03 18:08:54 +05:30
Arjun Kathuria
6b89646c1e update installStackBindist to take a "Maybe FilePath" argument for isolated installs 2021-08-03 18:08:54 +05:30
Arjun Kathuria
960d5ce79f deletes installHLSBinIsolated function 2021-08-03 18:08:54 +05:30
Arjun Kathuria
90ed0895d6 updates usages of installHLSBin across files 2021-08-03 18:08:54 +05:30
Arjun Kathuria
7471f4f4dc update installHLSBindist to take a "Maybe FilePath" argument for isolated installs 2021-08-03 18:08:54 +05:30
Arjun Kathuria
781cf8eed5 Delete installCabalBinIsolated function. 2021-08-03 18:08:54 +05:30
Arjun Kathuria
236da31af6 updates usages of new installCabalBindist across files. 2021-08-03 18:08:54 +05:30
Arjun Kathuria
1f760af880 update installCabalBindist to take a "Maybe FilePath" argument for isolated installs 2021-08-03 18:08:54 +05:30
Arjun Kathuria
62d03b776b remove installGHCBinIsolated function. 2021-08-03 18:08:54 +05:30
Arjun Kathuria
37ea18a0d8 updates usages of new installGHCBindist and related installGHCBin 2021-08-03 18:08:54 +05:30
Arjun Kathuria
083dc59a8f update installGhcBindist to take a "Maybe FilePath" to work with isolated installs 2021-08-03 18:08:54 +05:30
Arjun Kathuria
a45d069cad Adds a log to notify where the isolated ghc is being installed by the tool 2021-08-03 18:08:54 +05:30
Arjun Kathuria
fdbcd4fafd Adds isolated installs to Stack install 2021-08-03 18:08:54 +05:30
Arjun Kathuria
f3c1c925ed updates installStack' usage in installStackBindist function 2021-08-03 18:08:54 +05:30
Arjun Kathuria
8f6a7ba39c factor out installStack' function 2021-08-03 18:08:54 +05:30
Arjun Kathuria
f212eb4570 Adds isolated install to HLS installs 2021-08-03 18:08:54 +05:30
Arjun Kathuria
0d118e2fe1 update installHLS' usage in installHLSBindist 2021-08-03 18:08:54 +05:30
Arjun Kathuria
c0f46ef81f Factor out installHLS' 2021-08-03 18:08:54 +05:30
Arjun Kathuria
476513b0a7 Adds isolate install functionality to 'Cabal' tool installs 2021-08-03 18:08:54 +05:30
Arjun Kathuria
9a511669a8 use the new factored out installCabal' in installCabalBindist function 2021-08-03 18:08:54 +05:30
Arjun Kathuria
a16a25a3cd factor out installCabal' from installCabalBindist, to be shared with installCabalBinIsolated function 2021-08-03 18:08:54 +05:30
Arjun Kathuria
8666fcd120 adds rudimentary isolate capability to ghcup install ghc command 2021-08-03 18:08:54 +05:30
Arjun Kathuria
521ab0aedb adds basic --isolate option structure for install commands 2021-08-03 18:08:54 +05:30
vglfr
1cfff674b7
Implement config CLI MVP 2021-08-03 09:09:47 +03:00
88d1d19f55
Merge branch 'bump-bs-ver' 2021-07-31 16:38:12 +02:00
0fb1da5c3a
Bump ghc version in bootstrap-haskell 2021-07-31 16:23:01 +02:00
b32f88e9a6
Merge branch 'update-hls-1.3.0' 2021-07-31 14:44:16 +02:00
9d2421fac5
Update to HLS 1.3.0 2021-07-31 13:30:29 +02:00
043e288fbf
Add tipps and tricks section 2021-07-30 20:06:19 +02:00
32e34876e2
Update 2021-07-29 22:45:48 +02:00
f12a2b3821
Update README 2021-07-29 22:40:35 +02:00
844b4decab
Update FAQ 2021-07-29 22:35:52 +02:00
53ca60596d
Fix nuclear order 2021-07-29 11:51:47 +02:00
2d2894b0f4
Bump metadata 2021-07-29 10:50:07 +02:00
21d30cd8ce
Fix GHCup showing up twice in list 2021-07-28 22:48:28 +02:00
b38a569124
Bump to 0.1.16.1 2021-07-28 22:36:59 +02:00
810607e84f
Update yamls 2021-07-28 22:31:56 +02:00
442ddfd4e4
Bump ghcup metadata, because new GHC versions may have different bin/ layout 2021-07-28 20:08:20 +02:00
096103e65a
Refreeze 2021-07-28 18:42:57 +02:00
60a56c337c
Merge branch 'travis' 2021-07-28 18:42:35 +02:00
11c1b2cc6c
Re-add travis 2021-07-28 18:02:34 +02:00
45db3bd913
Update README 2021-07-28 11:07:53 +02:00
6d76561340
Update CHANGELOG for 0.1.16 2021-07-27 23:34:32 +02:00
00caeba067
Merge branch 'fix-list-tools' 2021-07-27 23:16:18 +02:00
5a34191b88
Fix listTools to always show currently installed GHCup 2021-07-27 22:33:35 +02:00
85003900d7
Improve HLS post-install formatting 2021-07-27 20:58:39 +02:00
0c666a6bbe
Fix upgrade subcommand running appstate twice 2021-07-27 20:57:51 +02:00
e4e52ebf6b
Bump to 0.1.16 2021-07-27 20:39:12 +02:00
4512468108
Also upload dist-newstyle/cache on failure 2021-07-27 10:39:55 +02:00
d3e3ebd63f
Merge branch 'fix-ghcToolFiles' 2021-07-26 21:25:00 +02:00
ce616d3eb3
Improve bootstrap-haskell.ps1 2021-07-26 18:14:07 +02:00
5837e04e6e
Cleanup 2021-07-26 18:13:57 +02:00
95ca79f3f8
Turn leftover files into logError 2021-07-26 18:13:41 +02:00
706fe1ffcc
Don't do update checks for all commands 2021-07-26 18:13:20 +02:00
2774f026e8
Merge branch 'issue-150' 2021-07-26 17:44:37 +02:00
07604a2eb5
Merge branch 'issue-193' 2021-07-26 17:39:13 +02:00
Arjun Kathuria
03d77f5006 updates Bindist functions as per https://gitlab.haskell.org/haskell/ghcup-hs/-/merge_requests/127#note_366702 2021-07-26 11:49:52 +05:30
fdf45e0fe6
Do etags hashing wrt #193 2021-07-25 23:15:59 +02:00
1dc9ad7a57
Merge branch 'www-false' 2021-07-25 19:56:56 +02:00
cc51d7b454
Merge branch 'add-binutils-gold-for-alpine-pkgs' 2021-07-25 19:56:24 +02:00
c439693a8f
Fix "display all supported installers" page 2021-07-25 19:10:02 +02:00
af8c097092
Add binutils gold for alpine pkgs 2021-07-25 19:06:22 +02:00
Arjun Kathuria
71e6dbfdca rename some auxiliary functions to their "unpacked" versions 2021-07-25 22:34:53 +05:30
Arjun Kathuria
692cd1616b deletes installStackBinIsolated function 2021-07-25 22:25:25 +05:30
Arjun Kathuria
4e3dbea5d0 updates usages of new installStackBin across files 2021-07-25 22:24:38 +05:30
Arjun Kathuria
fd2add78bd update installStackBindist to take a "Maybe FilePath" argument for isolated installs 2021-07-25 22:23:58 +05:30
Arjun Kathuria
e9da8ab439 deletes installHLSBinIsolated function 2021-07-25 22:10:43 +05:30
Arjun Kathuria
9c22ba9d45 updates usages of installHLSBin across files 2021-07-25 22:10:10 +05:30
Arjun Kathuria
e5d3080b54 update installHLSBindist to take a "Maybe FilePath" argument for isolated installs 2021-07-25 22:09:54 +05:30
Arjun Kathuria
5995a8b592 Delete installCabalBinIsolated function. 2021-07-25 22:09:54 +05:30
Arjun Kathuria
bc6d006c57 updates usages of new installCabalBindist across files. 2021-07-25 22:09:54 +05:30
Arjun Kathuria
b148d8e2e7 update installCabalBindist to take a "Maybe FilePath" argument for isolated installs 2021-07-25 21:20:42 +05:30
Arjun Kathuria
4f7d41a8cc remove installGHCBinIsolated function. 2021-07-25 13:39:44 +05:30
Arjun Kathuria
5efe2e5f7a updates usages of new installGHCBindist and related installGHCBin 2021-07-25 13:38:32 +05:30
Arjun Kathuria
338f5f309d update installGhcBindist to take a "Maybe FilePath" to work with isolated installs 2021-07-25 13:35:41 +05:30
9639e695e2
Unhide stack 2021-07-23 16:13:07 +02:00
d2a2bde321
Merge branch 'mlang-cursor' 2021-07-23 14:46:06 +02:00
c85ff686b6
Fix cabal.project 2021-07-23 14:45:50 +02:00
48d3b3bc3e
Merge branch 'cursor' of https://github.com/mlang/ghcup-hs into mlang-cursor 2021-07-23 14:38:49 +02:00
94bd01aaca
Merge branch 'issue-165' 2021-07-23 14:35:07 +02:00
Arjun Kathuria
ba51cbad6f Adds a log to notify where the isolated ghc is being installed by the tool 2021-07-23 16:51:50 +05:30
Arjun Kathuria
511272e86d Adds isolated installs to Stack install 2021-07-23 16:46:11 +05:30
Arjun Kathuria
873f75da9f updates installStack' usage in installStackBindist function 2021-07-23 16:44:40 +05:30
Arjun Kathuria
42d4a66493 factor out installStack' function 2021-07-23 16:43:43 +05:30
Arjun Kathuria
9a79af6fd2 Adds isolated install to HLS installs 2021-07-23 16:25:01 +05:30
Arjun Kathuria
63f10a1871 update installHLS' usage in installHLSBindist 2021-07-23 16:23:52 +05:30
Arjun Kathuria
9686ee9826 Factor out installHLS' 2021-07-23 16:23:03 +05:30
Arjun Kathuria
4729364e99 Adds isolate install functionality to 'Cabal' tool installs 2021-07-23 15:57:42 +05:30
Arjun Kathuria
91d982c7b2 use the new factored out installCabal' in installCabalBindist function 2021-07-23 15:56:03 +05:30
Arjun Kathuria
8b7c22440e factor out installCabal' from installCabalBindist, to be shared with installCabalBinIsolated function 2021-07-23 15:52:28 +05:30
Mario Lang
761b8cc750 Place an (invisible) cursor at the beginning of the active list item
This change is to support screen readers which use the cursor location
to indicate the focus to the user.

Brick.putCursor is unreleased, so grab the latest version from git via extra-deps.
2021-07-23 11:53:28 +02:00
3bdc82c99b
Redo file handling wrt #165 and #187 2021-07-22 17:44:03 +02:00
Arjun Kathuria
9b3d55a095 adds rudimentary isolate capability to ghcup install ghc command 2021-07-22 19:32:56 +05:30
db4e9fa432
Merge branch 'issue-192' 2021-07-22 11:39:31 +02:00
530c25c6a1
Fix bootstrap haskell bashrc stuff 2021-07-22 11:21:45 +02:00
1c2cf98850
Fix file/dir removal on windows, fixes #165 2021-07-21 20:50:58 +02:00
b35dbca22e
Merge branch 'issue-183' 2021-07-20 23:54:37 +02:00
a4a7f73fb7
Allow to use Hadrian as build system, fixes #35 2021-07-20 23:51:31 +02:00
fd0ea3d858
Merge branch 'stack-2.7.3' 2021-07-20 23:11:21 +02:00
bbbe52f453
Bump stack to 2.7.3 2021-07-20 22:30:50 +02:00
Arjun Kathuria
e2daf5381c adds basic --isolate option structure for install commands 2021-07-20 22:05:01 +05:30
9e181b8820
Allow passing "flavor" to 'ghcup compile ghc'
Fixes #183
2021-07-20 13:39:39 +02:00
a6108f8319
Fix listVersion wrt #183 2021-07-20 11:54:14 +02:00
7a2570019a
Return the version during 'ghcup compile ghc -g <commit>'
Fixes #181
2021-07-20 11:42:36 +02:00
c5b4e82b48
Merge branch 'issue-187' 2021-07-20 00:57:08 +02:00
4ed72fb517
Preserve mtimes on unpacked GHC tarballs on windows wrt #187 2021-07-19 23:33:01 +02:00
5217aa0a1d
Merge branch 'issue-180' 2021-07-19 20:55:17 +02:00
3caf91c640
Fix ensureGlobalTools 2021-07-19 19:08:43 +02:00
eb26a5133f
Merge branch 'www-fix-true' 2021-07-19 17:01:03 +02:00
9e9402a3a2
Fix www 2021-07-19 16:58:42 +02:00
bc13a4555d
Fix runLeanWhereIs on windows 2021-07-19 16:56:28 +02:00
eaad2caf25
Add prefetch command 2021-07-19 16:51:40 +02:00
6143cdf2e0
Add --offline switch wrt #186 2021-07-19 13:49:24 +02:00
2c7176d998
Use LabelOptic and add LeanAppState
Wrt #186
2021-07-18 14:39:49 +02:00
327b80cf56
Add cross compilation to CI test 2021-07-15 23:26:48 +02:00
005c9fbb83
Modernize CI scripts 2021-07-15 22:44:54 +02:00
42134fd2a5
Fix whereIsTool for cross 2021-07-15 22:38:42 +02:00
bc85a7d9c3
Fix cross installation
See https://gitlab.haskell.org/ghc/ghc/-/issues/14297
2021-07-15 20:32:09 +02:00
7e14fd4a08
Only run unsafeInterleaveIO when necessary 2021-07-15 20:30:14 +02:00
bf74d1e828
Merge branch 'issue-179' 2021-07-15 20:01:25 +02:00
f04708e8ae
Speed up 'whereis' subcommand wrt #179 2021-07-15 20:01:00 +02:00
80e1924e5f
Merge branch 'scoop' 2021-07-13 20:27:15 +02:00
c7393bd7c5
Fork shimgen into main repo, fixes #161 2021-07-13 20:25:29 +02:00
664713bb13
Fix darwin:aarch64 release 2021-07-13 19:41:12 +02:00
01715fdefc
Merge branch 'github-actions' 2021-07-13 17:26:03 +02:00
ab9b24e109
Switch to github actions wrt #178 and #159 2021-07-13 17:25:42 +02:00
34ecb1a56e
Add build-tool-depends: hspec-discover:hspec-discover 2021-07-13 17:25:13 +02:00
e3aef38f75
Merge branch 'update-stack-yaml' 2021-07-13 15:51:54 +02:00
ead2b76050
Switch to github actions wrt #178 and #159 2021-07-13 15:42:20 +02:00
2f35513f6e
Update stack.yaml 2021-07-13 15:26:43 +02:00
8573c99088
Update freeze stuff 2021-07-13 15:18:34 +02:00
dfe63332b2
Improve messages in bootstrap-haskell.ps1 2021-07-13 14:50:22 +02:00
767ae48c7b
Merge branch 'fix-install-stack' 2021-07-12 23:17:32 +02:00
f4160464c0
Merge branch 'www-update-win' 2021-07-12 23:15:46 +02:00
a572b1d5f0
Merge branch 'issue-177' 2021-07-12 23:15:06 +02:00
82587d26b5
Interactive should be the default! 2021-07-12 22:21:55 +02:00
ec98826e6d
Fix installStackBindist 2021-07-12 22:15:45 +02:00
b4fcd05e8f
Ask all questions at the beginning wrt #177 2021-07-12 22:14:56 +02:00
1345ec938b
Merge branch 'issue-173' 2021-07-12 17:09:46 +02:00
227f3acaa5
Implement 'whereis' subcommand, fixes #173 2021-07-12 17:09:18 +02:00
c20636f597
Fix adjust_bashrc on windows 2021-07-11 23:29:03 +02:00
c2d437150a
Merge branch 'issue-118' 2021-07-11 22:22:03 +02:00
9ff1467612
Add user choice for prepend/append of PATH
Fixes #118
2021-07-11 22:08:19 +02:00
9218efd71a
Update linux aarch64 and armv7 ghcup binaries, fixing #160 2021-07-11 19:35:46 +02:00
bcd244a92a
Merge branch 'improve-logging' 2021-07-11 17:41:32 +02:00
7de552ed82
Merge branch 'issue-160-CI' 2021-07-11 16:12:01 +02:00
5cf297a4d2
Clarify stack postinstall message wrt #153 2021-07-11 15:09:16 +02:00
d86f84eef4
Improve logging with newlines 2021-07-11 14:34:05 +02:00
83458c6c1e
Merge branch 'issue-163' 2021-07-11 13:51:27 +02:00
b862ca52a9
Update arm/aarch CI 2021-07-11 13:43:53 +02:00
928f4a97de
Fix ghcToolFiles for upcoming GHC build system changes
Also see: https://gitlab.haskell.org/ghc/ghc/-/issues/20074#note_363720
2021-07-10 21:43:37 +02:00
e8d79c9d38
Warn when powershell script is run as admin
Fixes #163
2021-07-09 22:29:10 +02:00
59e1eee8ce
Update linux aarch64 ghcup binary
Partly addresses #160
2021-07-09 22:06:37 +02:00
57c8ffda35
Update hacking docs 2021-07-09 19:51:21 +02:00
abbe51614d
Improve uninstallation on windows wrt #150 2021-07-07 23:19:50 +02:00
171ebd213d
Merge branch 'issue-175' 2021-07-07 20:47:44 +02:00
2a240cbd09
Make sure HLS and stack installation failures don't exit the entire script
Fixes #175
2021-07-07 20:08:12 +02:00
068fa3454c
Update website 2021-07-04 22:15:56 +02:00
6b2bcbf2ce
Merge branch 'issue-151' 2021-07-04 20:27:45 +02:00
19e46dac18
Avoid too many questions 2021-07-04 19:45:43 +02:00
e96c863120
Speed up installation wrt #151 2021-07-03 21:16:46 +02:00
a30b3c84d7
Loosen bound on versions wrt #164 2021-07-03 17:48:39 +02:00
0ad5dc4583
Fix CI 2021-07-03 16:51:58 +02:00
7189998f3b
Cleanup rmGhcupDirs a bit 2021-07-03 11:25:49 +02:00
b6b24b8e0b
Update CHANGELOG 2021-07-03 11:15:45 +02:00
8e820c6e89
Clean up and fix nuke command 2021-07-03 11:15:37 +02:00
c74784a37c
Merge remote-tracking branch 'origin/merge-requests/101' 2021-07-03 11:15:09 +02:00
3d940cffcf
Merge remote-tracking branch 'origin/merge-requests/102' 2021-07-02 14:37:19 +02:00
0df044b284
Merge remote-tracking branch 'origin/merge-requests/103' 2021-07-02 14:02:43 +02:00
f576b9fb20
Merge remote-tracking branch 'origin/merge-requests/104' 2021-07-02 14:01:58 +02:00
5e00264119
Update hashes 2021-07-02 13:56:03 +02:00
Tom Ellis
05eeba32fa Make it clear that Windows is supported 2021-07-01 13:43:24 +00:00
Arjun Kathuria
61019ecd49 Adds reporting remaining leftover files sorted by Depth. 2021-06-29 14:31:13 +05:30
Arjun Kathuria
bed06d1334 make reported leftover file paths absolute 2021-06-29 08:56:57 +05:30
Arjun Kathuria
f09f4bd1b7 Update the running of "Nuke" command in Main.hs 2021-06-29 08:47:44 +05:30
Arjun Kathuria
a3b11f21bb change logWarn to logDebug in "rmghcup / handlePathNotPresent" function 2021-06-28 19:35:48 +05:30
Arjun Kathuria
69a461d9c3 Fix a couple of typos in Main.hs 2021-06-28 19:32:09 +05:30
Arjun Kathuria
1dfe5cfecf updates path equating (which may fail) in "rmGhcup" function. 2021-06-28 13:56:20 +05:30
Arjun Kathuria
8e4550657e couple of windows indentation fixes in source files 2021-06-27 00:25:55 +05:30
Arjun Kathuria
aee7fa52c3 warn user if current running ghcup exec is in non-standard location 2021-06-26 23:58:38 +05:30
Arjun Kathuria
d166cc84a1 change type of rmGhcup fn from "Excepts '[NotInstalled] m ()" to m () 2021-06-26 23:26:31 +05:30
Arjun Kathuria
bb7229d224 Adds descriptive comments in rmGhcupDir explaing silent deletions and
leftover reporting.
2021-06-26 22:09:32 +05:30
Arjun Kathuria
708cd5ead9 Fix a minor typo in some conditional windows code. 2021-06-26 21:59:15 +05:30
Arjun Kathuria
f7986cb4da integrate new rmGhcupDirs fn into Main.hs 2021-06-26 21:56:52 +05:30
Arjun Kathuria
395aeb415d change return type of rmGhcupDirs to m [Filepath] from m () 2021-06-26 21:56:07 +05:30
Arjun Kathuria
830fb70492 adds returning left-over files back to Main.hs from rmGhcupDirs 2021-06-26 21:54:42 +05:30
Arjun Kathuria
6379a26afb factor out getDirectoryContentsRecursive function in GHCup.Utils.Prelude 2021-06-26 21:53:14 +05:30
Arjun Kathuria
2277013c76 hide unsupportedOperation error in windows ghcup bin removal in case
of different drives.
2021-06-26 20:05:21 +05:30
Arjun Kathuria
8934e0e6bd Merge branch 'feat-nuke' of gitlab.haskell.org:arjun/ghcup-hs into feat-nuke 2021-06-26 20:00:37 +05:30
Arjun Kathuria
59519febbc handle symlink case when deleting directories in rmGhcupDirs 2021-06-26 19:52:32 +05:30
Arjun Kathuria
46fcdd356c Use rmFile instead of removeFile. 2021-06-26 19:32:53 +05:30
Tom Ellis
9f343c45e8 Fix typo 2021-06-25 20:06:18 +00:00
Arjun Kathuria
931904f388 fix minor typo in conditional windows code 2021-06-25 17:00:39 +05:30
Arjun Kathuria
a40d0cbb5c swap out system.Directory.rename for Win32.File.moveFileEx for windows 2021-06-25 16:09:26 +05:30
Arjun Kathuria
9f5df9db10 Adds conditional windows ghcup bin removal code. Todo: test it, add
more exception handling if required.
2021-06-25 15:06:02 +05:30
Arjun Kathuria
d26ddf7015 adds rudimentary ghcup bin removal code. TODO: handle windows. 2021-06-25 13:54:38 +05:30
Arjun Kathuria
9515065407 adds conditional export of useXDG in non-windows OS-es. fix in rmGhcupDirs code that used useXDG 2021-06-24 22:48:38 +05:30
Arjun Kathuria
82a8c61cf6 adds bin dir removal code, checking for XDG 2021-06-24 10:54:38 +05:30
Arjun Kathuria
3fae516ce4 Adds using 'rmFile' fn in rmGhcupDirs, it has better windows handling logic 2021-06-24 10:08:21 +05:30
Arjun Kathuria
33eaa765d7 adds better error handling when removing files and dirs in rmGhcupDirs function 2021-06-23 23:23:54 +05:30
Arjun Kathuria
3b3dde8413 updates deleting dirs in rmGhcupDirs according to feedback on merge request 2021-06-23 10:36:17 +05:30
Arjun Kathuria
118a2744fe adds new getGhcupConfFilePath fn to GHCup.hs, also refactors to use for error handling in missing file cases 2021-06-23 10:10:28 +05:30
Arjun Kathuria
2e3dceecf8 abstracts out getting ghcup conf file path 2021-06-23 10:08:06 +05:30
Arjun Kathuria
07fb04bb74 Adds the new rmGhcupDirs function in Main.hs under Nuke command 2021-06-22 23:15:13 +05:30
Arjun Kathuria
8a1dbe9dbb basic implementation of rmGhcupDirs function that removes relevant dirs in NUKE command 2021-06-22 23:14:25 +05:30
Arjun Kathuria
4ef3622616 Adds argument de-structuring to 'rmTool' function & remove the one in its body 2021-06-22 20:09:35 +05:30
Arjun Kathuria
82a704ab44 Adds 10s Thread-Delay and relevant Logger messages to Main.hs 2021-06-22 18:53:18 +05:30
Arjun Kathuria
0cb22945fe Adds some logger messages. 2021-06-22 18:52:24 +05:30
Arjun Kathuria
d09adf9159 Updates Main.hs to work with new rmTool. 2021-06-22 18:51:03 +05:30
Arjun Kathuria
0b959c56fb change rmTool type to Excepts '[NotInstalled ] m () 2021-06-22 18:44:30 +05:30
Arjun Kathuria
ec29332657 Adds basic implementation of rmTool function 2021-06-22 14:29:26 +05:30
Arjun Kathuria
0f6381e67b Move Nuke Command a little down in the file 2021-06-18 15:09:01 +05:30
Arjun Kathuria
877b55e21d Adds basic "nuke" command structure so that it reflects in ghcup cli 2021-06-18 15:01:32 +05:30
Colin Barrett
fa11ca665f Use GetFolderPath to get the Desktop location
On my system, for example, Desktop is backed up with OneDrive
2021-06-15 22:25:24 -04:00
d9d196439f
Add windows HLS 1.2.0 2021-06-15 11:57:52 +02:00
a34fc4ad4f
Update HLS to 1.2.0 2021-06-14 00:35:21 +02:00
b4d52b88c1
Merge branch 'fix-ci' 2021-06-14 00:24:12 +02:00
3fc3d27361
Update metadata for 0.1.15.2 2021-06-14 00:21:13 +02:00
56b86add38
Fix CI 2021-06-13 22:52:26 +02:00
a608a105e3
Release 0.1.15.2 2021-06-13 22:07:33 +02:00
2e3e413f6c
Merge branch 'update-lol' 2021-06-13 21:29:22 +02:00
dfb6c09133
Enable libarchive wrt #147 2021-06-13 21:29:00 +02:00
9636276c17
Fix nancy 2021-06-13 19:29:25 +02:00
41783ff027
Fix ghcup upgrade if binary is in non-standard location 2021-06-13 15:08:31 +02:00
08b0ecd057
Allow to skip update checks 2021-06-13 15:05:39 +02:00
7e31798446
Fix ghcup_version.sh 2021-06-13 14:43:00 +02:00
534afa6e8d
Update windows CI 2021-06-13 14:15:48 +02:00
b56c44a210
Ensure directories 2021-06-13 13:41:06 +02:00
ef0c94fddd
Fix windows upgrade for good 2021-06-13 10:15:34 +02:00
f14c281841
Fix for real 2021-06-13 08:36:20 +02:00
b40cefee35
Fix 'ghcup upgrade' on windows 2021-06-13 07:51:54 +02:00
ff32ccfb50
Add warning about XDG dirs 2021-06-12 22:35:03 +02:00
581108ab65
Fix compliation from git 2021-06-12 22:27:56 +02:00
54e8e3efb0
Gracefully handle stack binary not installed by ghcup 2021-06-12 22:27:31 +02:00
4dcc63606e
Remove legacy handling of cabal binary 2021-06-12 22:26:50 +02:00
a396b6044d
Allow more failures 2021-06-12 16:08:30 +02:00
94e5d2e19f
Don't error on stack/hls failed install 2021-06-12 16:05:35 +02:00
a0976eee70
Mark stack 2.5.1 as old 2021-06-12 16:02:37 +02:00
61494d8c4b
Improve stack post install message 2021-06-12 16:01:15 +02:00
2b34c2dd69
Fix copy button under windows 2021-06-12 12:18:13 +02:00
afc30b87dd
Merge remote-tracking branch 'origin/merge-requests/97' 2021-06-12 02:42:06 +02:00
amesgen
ed0a63eb0c
fix ghcup-0.0.4.yaml
Windows is an unknown platform in < 0.1.15
2021-06-12 02:11:20 +02:00
9ba590dd90
Update www 2021-06-12 01:23:49 +02:00
d4bffd2c4a
Merge branch 'prepare-0.1.15.1' 2021-06-12 00:20:03 +02:00
650f0a3e4e
Fix up 0.1.15.1 2021-06-11 23:57:16 +02:00
fd6ccf8f0a
Add FreeBSD to 0.1.14.1 2021-06-11 22:51:40 +02:00
d9fe4b8723
Use homebrew llvm 2021-06-11 22:17:18 +02:00
da2e7e0411
Fix aarch64 darwin thanks to bgamari 2021-06-11 22:17:02 +02:00
79d6a50e44
Drop some mingw64 packages we don't need 2021-06-11 22:12:23 +02:00
a13a5e5d20
Update darwin aarch64 install deps 2021-06-11 20:29:24 +02:00
82743dda2b
Merge remote-tracking branch 'origin/merge-requests/96' 2021-06-11 20:27:47 +02:00
jneira
6f80dd1fcc Registry api win7 compat 2021-06-11 14:36:52 +02:00
1325dce493
Update darwin aarch64 install deps 2021-06-11 11:52:20 +02:00
ac21c19b7e
Remove unnecessary micro version stripping
Since we can specify version bounds now, this is unnecessary.
2021-06-11 11:26:44 +02:00
2b4088d068
Add FreeBSD 8.10.5 tarballs 2021-06-10 18:24:42 +02:00
d86dc9b1d7
Fix release script 2021-06-10 15:39:50 +02:00
9982311c87
Update lzma-static 2021-06-10 15:10:53 +02:00
40c88d0b66
Add Darwin Big Sur AARCH64 binaries 2021-06-10 15:07:25 +02:00
e0ee1c2f94
Bump to 0.1.15.1 2021-06-10 14:00:26 +02:00
b4fa2780eb
Cleanup 2021-06-10 13:57:59 +02:00
df86183e97
Merge branch 'update-CI' 2021-06-10 13:57:36 +02:00
f7868dc646
Update install_deps 2021-06-10 13:57:02 +02:00
e742be7693
Allow to specify cabal directory 2021-06-10 10:58:24 +02:00
924bc8698d
Make Silent a switch 2021-06-10 10:58:07 +02:00
5214c35b20
Fix CI 2021-06-09 21:30:26 +02:00
700e04535a
Enable Mac AARCH64 2021-06-09 19:03:48 +02:00
fedc0bbef6
Debug 2021-06-09 18:38:24 +02:00
468fc5ade9
Use absolute ghcup binary path 2021-06-09 15:02:11 +02:00
2c077db36b
Improve portability 2021-06-09 14:43:48 +02:00
f80638bba4
Improve error handling 2021-06-09 14:43:36 +02:00
860aa0dafd
Improvements to bootstrap scripts 2021-06-08 23:46:20 +02:00
27510b3b51
Allow setting GHCUP_INSTALL_BASE_PREFIX on windows 2021-06-08 18:08:06 +02:00
96bcbbeeec
Update CI 2021-06-07 20:40:59 +02:00
8a632eb3b4
Merge branch 'windows-bootstrap-fixes' 2021-06-07 20:29:39 +02:00
aa992c0e5d
PrettyShow 2021-06-07 20:09:18 +02:00
810870e3a5
Fix Validate 2021-06-07 20:04:55 +02:00
d584e7b21b
Update shimgen URL 2021-06-07 20:04:45 +02:00
e93ac62c81
Add alpine 32 bit GHC-8.10.5 2021-06-07 20:04:27 +02:00
0d7d6c8382
Fix CI 2021-06-07 19:35:06 +02:00
5cd9ce8835
Fix build with zip 2021-06-07 19:33:12 +02:00
443522d526
Improve windows bootstrapping and make msys2 configurable 2021-06-07 19:33:12 +02:00
9061e60518
Allow to run powershell script straight 2021-06-07 14:48:06 +02:00
d65ab434b2
Fix windows link 2021-06-06 15:33:57 +02:00
cff592db82
Update bootstrap-haskell 2021-06-06 15:32:38 +02:00
97029e8102
Merge remote-tracking branch 'origin/merge-requests/92' 2021-06-06 12:10:35 +02:00
Fendor
828fd9eb10 Mention HLS in Help Message 2021-06-06 11:59:51 +02:00
03800d3b74
Hardcode C:\ in windows bootstrap script 2021-06-06 11:59:05 +02:00
a47304e599
Add ghcup-0.0.5.yaml to cabal extra docs 2021-06-06 11:58:51 +02:00
7b050e9fe2
Fix ghcup-gen validation for global tools 2021-06-06 11:57:37 +02:00
687a1d0c88
Merge branch 'fix-freebsd-build' 2021-06-06 11:28:36 +02:00
e09e3c264d
Fix build on FreeBSD
Related: https://gitlab.haskell.org/ghc/ghc/-/issues/19948
2021-06-06 11:08:40 +02:00
b56431b4e3
Update ghcup-0.0.x.yaml 2021-06-06 08:55:41 +02:00
70ad50010d
Merge remote-tracking branch 'origin/merge-requests/90' 2021-06-06 08:12:24 +02:00
amesgen
ca3a249bea
make ghcup-0.0.4.yaml compatible with ghcup-0.1.14.1 2021-06-06 04:30:23 +02:00
amesgen
4337cdc38d
add GHC 8.10.5 2021-06-06 04:18:03 +02:00
9f92e0bc86
Fix #136 2021-06-05 22:26:35 +02:00
98751cf8fb
Merge branch 'windows-support' 2021-06-05 22:25:16 +02:00
2f62067d96
Windows support 2021-06-05 21:01:01 +02:00
2cb1554244
Fix stray br 2021-06-02 23:25:44 +02:00
6f3c143228
Update www to indicate WSL2 is needed 2021-06-02 23:17:08 +02:00
9793fc6888
Update stack things 2021-05-30 15:17:04 +02:00
043cab08ae
Update www 2021-05-20 19:21:57 +02:00
b7c83780da
Update remaining links 2021-05-19 19:22:51 +02:00
cff11135ff
Update IRC link 2021-05-19 19:19:12 +02:00
b94a4123eb
Update README 2021-05-15 22:17:51 +02:00
8ef1c8b5d4
Merge branch 'stack-support' 2021-05-15 22:13:39 +02:00
132d331e7c
Fix CI 2021-05-15 14:01:00 +02:00
734916728c
Add stack support 2021-05-15 14:01:00 +02:00
5f6ed1292d
Remove dead dependency on ascii-string
This hopefull fixes nix packaging.
2021-05-12 13:42:27 +02:00
a7dc03af50
Merge branch 'PR/issue-126' 2021-05-11 14:42:22 +02:00
5a86a28d67
Smarter logging 2021-04-29 14:47:30 +02:00
a905c6322c
Fix spelling 2021-04-29 14:47:22 +02:00
49ccadd470
Warn when overwriting current GHC due to compile 2021-04-29 14:46:45 +02:00
9f0ac0ee19
Allow to compile from git repo 2021-04-28 21:17:57 +02:00
7e0f839ff8
Fix cabal bindist on 32bit
See https://github.com/haskell/cabal/issues/7313
2021-04-25 22:44:41 +02:00
1e9ee260e7
Raise minSpace to 5GB 2021-04-25 21:32:58 +02:00
0b7d447aaf
Satisfy hlint 2021-04-25 18:00:32 +02:00
16a9336d31
Fix missing pretty instance 2021-04-25 17:59:15 +02:00
7d13836fea
Warn when /tmp doesn't have 2500 or more of disk space 2021-04-25 17:25:40 +02:00
b645c4d57e
Add date to GHC bindist names created by ghcup 2021-04-24 21:51:43 +02:00
5db43cd908
Improve error printing in ghcup-gen 2021-04-24 21:51:06 +02:00
93cd421ca3
Add 9.1.1 alpha2 2021-04-23 09:43:45 +02:00
ec7130dac6
Add post-install msg to ghc-7.10.3 wrt no-pie, fixes #123 2021-04-17 19:53:18 +02:00
f2b8cc530c
Fix download URL 2021-04-13 23:58:49 +02:00
de765088d1
Merge remote-tracking branch 'origin/merge-requests/83' 2021-04-13 23:47:16 +02:00
jneira
e11188aa99 Update haskell-language-server to 1.1.0 2021-04-13 23:38:27 +02:00
0c6699c3c6
Allow to check ghcup binaries in validate-tarballs 2021-04-11 22:15:43 +02:00
c5858be6b8
Update ghcup binaries 2021-04-11 22:10:44 +02:00
ffe00c7b1f
Fix travis 2021-04-11 19:16:45 +02:00
43114959fd
Fix release job 2021-04-11 19:12:55 +02:00
b1c3ffd729
Update ghcup.cabal 2021-04-11 18:14:52 +02:00
4f1a9e95a2
Add stuff to extra-doc-files 2021-04-11 18:08:31 +02:00
f6a4f55384
Release 0.1.14.1 2021-04-11 18:01:31 +02:00
672b179446
Merge branch 'lzma-static' 2021-04-11 17:58:03 +02:00
3111387e5a
Bump lzma-static 2021-04-11 16:31:44 +02:00
f8fda269f1
Install lbzip2 on fedora image 2021-04-11 16:24:13 +02:00
fbac593739
Fix build on FreeBSD 2021-04-10 13:29:36 +02:00
c80e54dff5
Fix up stack 2021-04-09 19:45:47 +02:00
4a86b2479e
Fix up .cabal file 2021-04-09 19:39:14 +02:00
7bb2552d0f
Tighten bounds for hackage 2021-04-09 19:18:44 +02:00
ad21640cd9
Please 'cabal check' 2021-04-09 19:13:36 +02:00
e4aad4e645
Use lzma-static 2021-04-09 19:01:31 +02:00
adf44ba141
Validate subdirs too, fixes #52 2021-04-02 16:54:27 +02:00
8707b194fd
Add GHC-9.2.1-alpha1 2021-04-02 16:34:14 +02:00
77bb7c4aba
Merge branch 'PR/issue-119' 2021-04-01 21:03:14 +02:00
7383fdd0c0
Make parser more lax, fixes #119
Also make sure we don't print the warning message
20 times, so avoid some repeated IO.
2021-04-01 17:21:00 +02:00
f4201d946a
Merge branch 'chores' 2021-03-24 18:50:26 +01:00
d5b5f1fddd
Chores 2021-03-24 17:56:57 +01:00
910d660732
Update README 2021-03-08 17:59:56 +01:00
ab4ad3a1bb
Merge branch 'PR/issue-106' 2021-03-08 17:36:00 +01:00
13b27101f1
Create fish config dir if it doesn't exist
Fixes #106
2021-03-08 16:18:26 +01:00
44b5d0dcff
Merge branch 'PR/cabal-updates' 2021-03-08 10:35:06 +01:00
df54b3711f
Update cabal.project etc 2021-03-07 20:54:53 +01:00
197288453f
Update cabal.project etc 2021-03-07 19:46:44 +01:00
00d5691a13
Post release tasks 2021-03-07 14:50:08 +01:00
561b6684ce
Update travis 2021-03-07 12:33:21 +01:00
a13bb3154d
Update CHANGELOG 2021-03-07 12:27:04 +01:00
fd9d3faf9f
Merge branch 'PR/issue-116' 2021-03-07 12:24:05 +01:00
f6cc467e95
Fix handling of stray versions wrt #116 2021-03-07 12:02:13 +01:00
ef978c1230
Add test case for issue #116 2021-03-07 11:59:45 +01:00
52af598473
Update ghcup in old yamls 2021-03-06 16:02:09 +01:00
2acacd46c2
Bump stack.yaml 2021-03-02 19:37:09 +01:00
4b2f9ddb40
Update project files 2021-03-02 19:22:14 +01:00
0d3dc4eba2
Bump ghcup version 2021-03-02 12:39:24 +01:00
824faa8091
Update CHANGELOG 2021-03-02 12:38:11 +01:00
d10cdfdf57
Merge branch 'PR/issue-115' 2021-03-02 12:34:52 +01:00
5e911793ce
Document env variables wrt #95 2021-03-02 10:51:23 +01:00
8c87c9aeb7
Fix error messages and overhaul pretty printing
Fixes #115
2021-03-02 10:35:31 +01:00
9da5998a5c
Add some fancy messages 2021-02-26 19:55:33 +01:00
08943dadca
Fix validation 2021-02-26 16:06:08 +01:00
7fac7226c5
Update ghcup 2021-02-26 15:38:35 +01:00
9686c8ebf9
Update changelog 2021-02-26 11:53:57 +01:00
4bf96d0ec9
Revert version bump in bootstrap script 2021-02-25 19:19:53 +01:00
34add82bee
Merge branch 'PR/issue-114' 2021-02-25 19:18:13 +01:00
f46e7e8c4b
Add "ghcup set ghc next" tag wrt #114 2021-02-25 19:10:55 +01:00
3baf254251
Improve tag completer 2021-02-25 16:13:00 +01:00
10ca9ea827
Reformat versionCompleter 2021-02-25 15:52:28 +01:00
4a50c8ecb7
Remove network call on shell completion 2021-02-25 15:46:08 +01:00
47d9766c78
Make sure forFold can properly inline 2021-02-25 15:40:52 +01:00
45ab69960f
Merge remote-tracking branch 'origin/merge-requests/70' 2021-02-25 15:36:37 +01:00
d3505d4ee6
Bump version to 0.1.13 2021-02-25 15:33:52 +01:00
9297d1a2f8
Merge branch 'arm' 2021-02-25 14:22:59 +01:00
56feb7c09e
Use stages in CI 2021-02-25 14:14:01 +01:00
bede4b8712
Merge branch 'www-fix-silicon-copy' 2021-02-25 13:33:11 +01:00
95c1c55f22
Fix copy button for apple silicon 2021-02-25 13:32:46 +01:00
f547a6eb68
Support ARM/AARCH 2021-02-25 11:53:36 +01:00
Huw campbell
453a29fdf7 Respect the user's configuration settings
Only lookup user configuration before doing a search; implement version completion for Cabal and HLS removal
2021-02-25 16:31:40 +11:00
Huw campbell
1a5f0259f4 Just use the cache for commands which refer to locally stored objects.
Setting a version of GHC will fail if provided with a version not installed,
and we don't neede to check the most recent list of GHCs available to know
that.
2021-02-25 10:19:16 +11:00
Huw campbell
d6fa61e223 Add command line completions for installed and available versions.
When running `ghcup set ghc` and pressing tab, one should be able to
autocomplete the currently installed GHCs we have available.

Add an optparse applicative completer for install, rm, and set commands
which shows tags and versions. For installation, all are shown; while
for remove and set, only those installed are.
2021-02-25 00:42:16 +11:00
eab82b5d63
Update HLS to 1.0.0 2021-02-24 12:43:04 +01:00
c455b521a9
Fix ghcup-tui 2021-02-24 12:42:36 +01:00
b4f9e12293
Merge remote-tracking branch 'origin/merge-requests/54' 2021-02-24 10:13:46 +01:00
bbd353ea3a
Merge branch 'PR/issue-107' 2021-02-23 18:40:04 +01:00
4189c5de69
Update CHANGELOG 2021-02-23 17:11:45 +01:00
dee3218723
Fix item selection with unavailable versions
Fixes #107
2021-02-23 17:10:48 +01:00
3c803a9f58
Merge branch 'PR/issue-104' 2021-02-23 12:52:19 +01:00
a9b0c0fbc9
Allow for dynamic post-install, post-remove and pre-compile msgs 2021-02-23 11:52:38 +01:00
38b6c918f9
Update CHANGELOG 2021-02-21 21:03:12 +01:00
6e584c96c4
Merge branch 'PR/issue-111' 2021-02-21 21:01:59 +01:00
20338f7d14
Alert user if upgraded ghcup is shadowed by old ghcup
Also alerts if the binary is not in PATH at all.

Fixes #111
2021-02-21 19:58:32 +01:00
1a995a5d63
Merge branch 'PR/cabal-3.4.0.0' 2021-02-21 16:34:18 +01:00
f964382175
Tighten checks, alpine 32bit bindists is 1st class 2021-02-21 15:37:05 +01:00
0c7f60fae6
Add more alpine 32bit bindists 2021-02-21 15:35:33 +01:00
413e63d1ca
Update hasufell.de hosted bindists to webhost.haskell.org 2021-02-21 15:34:55 +01:00
8b000f4e48
Add cabal-3.4.0.0 final release 2021-02-20 23:30:28 +01:00
b0522507be
Merge branch 'PR/ubunbu-20.10-update-reqs/110' 2021-02-16 16:40:03 +01:00
d4bcf7021e
Merge branch 'PR/fix-109' 2021-02-16 16:26:13 +01:00
48cf0b1f67
Update libffi req for ubuntu groovy
Fixed #110
2021-02-16 14:41:49 +01:00
d82e189c01
Fix failed ghcup upgrade if destination dir doesn't exist
Fixes #109
2021-02-16 14:37:17 +01:00
e5a60d1b9a
Merge branch 'ghc-8.10.4' 2021-02-06 22:39:52 +01:00
ff067351cb
Add GHC-8.10.4 2021-02-06 14:28:58 +01:00
345712a617
Add freeze/project file for ghc-8.10.3 2021-02-05 11:59:57 +01:00
118dac6907
Merge branch 'bump-GHC-CI' 2021-02-05 11:51:11 +01:00
5ca40caf81
Bump GHC/Cabal in CI 2021-02-05 11:02:45 +01:00
d858187fd4
Merge remote-tracking branch 'origin/merge-requests/61' 2021-02-05 10:49:39 +01:00
bd65517df1
Add changelog for ghc-9.0.1 2021-02-04 23:20:19 +01:00
b1acad6c95
Set 8.10.3 as recommended 2021-02-04 22:59:17 +01:00
a8333281ac
Bump to GHC-9.0.1 2021-02-04 22:49:49 +01:00
2fdb08ac00
Merge remote-tracking branch 'origin/merge-requests/59' 2021-01-31 11:19:22 +01:00
Javier Neira
bd4e5a2314 Update haskell-language-server to 0.9.0 2021-01-30 15:36:34 -05:00
34ed317b6b
Merge remote-tracking branch 'origin/merge-requests/58' 2021-01-13 10:13:40 +08:00
Enrico Maria De Angelis
14661502ab #103: Rewording of warning message 2021-01-11 07:12:19 +00:00
097754ffdf
Merge remote-tracking branch 'origin/merge-requests/57' 2021-01-05 08:24:30 +08:00
amesgen
f26ec6d295
update HLS to 0.8.0 2021-01-04 21:02:38 +01:00
858d430845
Add ghc-8.10.3 for alpine 32bit 2021-01-04 09:51:36 +08:00
5134eccbf8
Update HACKING.md 2021-01-02 16:07:41 +08:00
28b4737758
Merge remote-tracking branch 'origin/merge-requests/56' 2021-01-02 15:57:18 +08:00
amesgen
5c43ff4c9e
error if we check nothing 2021-01-02 08:51:57 +01:00
amesgen
53db68e39f
minor tarball filter format change 2021-01-02 07:58:08 +01:00
9e628e34dd
Merge remote-tracking branch 'origin/merge-requests/55' 2021-01-02 14:27:11 +08:00
amesgen
62d5d53232
filter tool and version instead of URL 2021-01-02 05:53:11 +01:00
amesgen
56569a0698
use regex instead of substring 2021-01-02 05:05:05 +01:00
amesgen
ef44f818d0
add GHC 9.0.1-rc1 2021-01-01 05:50:54 +01:00
amesgen
8944ed6e36
allow to filter tarball validation by a URL substring
also, use nubOrd for linearithmic instead of quadratic complexity
2021-01-01 05:45:58 +01:00
51805b27aa
Update CHANGELOG 2020-12-30 17:01:45 +08:00
0ec64510b3
Update CHANGELOG 2020-12-30 16:52:46 +08:00
20152443da
Fix hash for 8.10.3 src dist 2020-12-30 11:47:26 +08:00
Ron Toland
7c8929fe9f add default install instructions for apple silicon 2020-12-26 06:33:32 -08:00
5617516c93
Merge remote-tracking branch 'origin/merge-requests/52' 2020-12-25 01:26:08 +08:00
f6fe08367d
Fix cabal prerelease download URLs wrt #102 2020-12-24 04:46:05 +08:00
a5f02133e2
Merge remote-tracking branch 'origin/merge-requests/53' 2020-12-24 01:57:58 +08:00
Ron Toland
8ed9b4432d Add install cmd for Apple Silicon wrt #101 2020-12-23 06:51:54 -08:00
amesgen
db1d05e8ad
add GHC 8.10.3 2020-12-21 00:52:00 +01:00
eae58137c8
Merge remote-tracking branch 'origin/merge-requests/47' 2020-12-20 01:45:49 +08:00
b0f90c096f
Fix chmod on executables, wrt #97 2020-12-20 01:27:27 +08:00
e8361c564a
Merge remote-tracking branch 'origin/merge-requests/51' 2020-12-19 03:30:40 +08:00
amesgen
54db9c9a92
update HLS to 0.7.1 2020-12-18 15:32:50 +01:00
amesgen
73db341dc8
update HLS to 0.7.0 2020-12-16 00:58:26 +01:00
5fd30b412b
Merge remote-tracking branch 'origin/merge-requests/49' 2020-11-28 12:46:16 +01:00
Anton-Latukha
bbe2e87640
CHANGELOG.md: add note about ghcup directory fix` 2020-11-28 12:34:58 +02:00
Anton-Latukha
67f59f6895
bootstrap-haskell: fx XDG GHCUP_DIR value 2020-11-28 01:41:43 +02:00
Anton-Latukha
3e2df2e111
bootstrap-haskell: create GHCUP_DIR 2020-11-28 01:27:35 +02:00
824d2149c6
Merge remote-tracking branch 'origin/merge-requests/48' 2020-11-27 20:26:33 +01:00
Anton-Latukha
c86dbe043b
bootstrap-haskell: mention the license
Since script is served separately from the main source code (can be opened over
https://get-ghcup.haskell.org) - mention the script license to the reciever.
2020-11-27 17:06:39 +02:00
Anton-Latukha
8043ac7f51
bootstrap-haskell: provide instructions for the main settings
Provide some basic instructive information to someone who views the script.
2020-11-27 17:04:00 +02:00
Paolo Martini
ead9d31647
Apply NO_COLOR to dimAttributes as well to cover all tui colors 2020-11-26 20:22:32 +01:00
Paolo Martini
a08e624309
Respect NO_COLOR environment variable in list and tui 2020-11-25 11:41:53 +01:00
b20371c3ac
Add default values to all XDG_ variables documentation 2020-11-21 16:31:50 +01:00
0589a7cbcc
Document XDG_CONFIG_HOME wrt #85 2020-11-21 16:29:26 +01:00
cf48961063
Bump ghcup to 0.1.12 2020-11-21 14:23:37 +01:00
6046582b9c
Improve version ranges 2020-11-21 14:05:34 +01:00
82aa6c70ea
Allow to encode version ranges for distro versions
Fixes #84
2020-11-21 01:12:15 +01:00
e829bd8235
Fix brick not updating downloads correctly 2020-11-21 00:32:58 +01:00
66f989e691
Fix FromJSONKey instances
This led to silent Nothing when the parser failed.
2020-11-20 23:18:25 +01:00
eebb91fbb0
Use extra-doc-files for CHANGELOG.md 2020-11-20 23:16:13 +01:00
1d3e88bdfe
Fix disappearing HLS symlinks wrt #91
When installing a new GHC version, the corresponding
HLS symlink of that version may be accidentially removed.

Ooops.
2020-11-20 23:05:37 +01:00
fbb03dee7e
Merge remote-tracking branch 'origin/merge-requests/44' into master 2020-11-12 10:49:26 +01:00
amesgen
88e5afb70f
update HLS to 0.6.0 2020-11-11 23:19:05 +01:00
67eabfd3af
Update CHANGELOG 2020-10-30 22:27:41 +01:00
cd1dd8c29e
Merge branch 'PR/82' into master 2020-10-30 22:26:33 +01:00
08ddb591b7
Add toolchain sanity checks wrt #82 2020-10-30 21:07:49 +01:00
3e841b3c68
Merge branch 'settings' into master 2020-10-26 18:25:20 +01:00
53f5a08924
Allow configuring URLSource as well 2020-10-25 14:47:26 +01:00
d368863c3d
Improve help output 2020-10-25 11:00:00 +01:00
c76cce5830
Add a --set option to install/compile, fixes #81 2020-10-25 10:54:04 +01:00
4fef93b7b1
Allow to configure ghcup with a yaml config file
Fixes #41
2020-10-25 10:22:45 +01:00
241dadbeb5
Update to versions-4.0.1 API 2020-10-25 10:22:35 +01:00
12459c2544
Add internal downloader and tui flags to stack 2020-10-25 10:22:35 +01:00
e250d6013f
Redo Settings as AppState 2020-10-24 01:07:31 +02:00
0d41d180d6
Merge remote-tracking branch 'origin/merge-requests/40' into master 2020-10-14 11:59:15 +02:00
amesgen
ef251ce17e
update to cabal-3.4.0.0-rc4 2020-10-13 20:53:09 +02:00
956e11c3f8
Bump version to 0.1.12 2020-10-13 00:09:35 +02:00
951b0843b2
Update hls to 0.5.1 2020-10-12 23:54:56 +02:00
a4e4080a1b
Merge branch 'TUI-improvements' into master 2020-10-12 23:40:26 +02:00
2aa91c5d91
Update golden test 2020-10-12 21:48:06 +02:00
6471b3877f
Bump ghcup version in bootstrap-haskell 2020-10-12 21:05:25 +02:00
778ee142d5
Upload golden files as artifacts on failure 2020-10-12 00:10:37 +02:00
1140132a25
Update hie.yaml 2020-10-11 23:40:02 +02:00
c5c299179d
Remove text-conversion workaround 2020-10-11 23:39:49 +02:00
0ce4549eb8
Ditch the viewport logic 2020-10-11 23:37:27 +02:00
97d568ddd6
Show new versions in bright white 2020-10-11 21:44:11 +02:00
ea58465240
Expand the selected bar 2020-10-11 21:16:48 +02:00
7afd262b1b
Put separators between tools 2020-10-11 21:07:21 +02:00
34ceaa0823
Add brick to stack.yaml 2020-10-11 21:06:58 +02:00
57c34a07f2
Allow to hide old versions of tools in TUI 2020-10-09 23:05:11 +02:00
73d1d97f1f
Reverse order of tool list in TUI 2020-10-09 20:25:52 +02:00
f7ed1a4bde
Commit ghc-8.8.4 cabal.project files
These are auto-generated from stack and meant for users.
2020-10-05 22:11:05 +02:00
bdd80d0229
Bump stack lts 2020-10-05 22:10:52 +02:00
0238f70c64
Bump hls to 0.5.0 2020-10-05 00:19:35 +02:00
24ff430c45
Add stack.yaml wrt #75 2020-10-01 17:49:23 +02:00
281fb14d4c
Rename ghc-9.0.1-alpha1 to 9.0.0.20200925 wrt #73 2020-09-29 23:33:55 +02:00
03bac93929
Improve bootstrap test 2020-09-29 10:57:21 +02:00
1ae0c2a654
Move printf to the right place 2020-09-29 10:52:31 +02:00
8140936bd3
Test bootstrap-haskell wrt #72 2020-09-29 10:23:29 +02:00
8786acf476
Fix BOOTSTRAP_HASKELL_NONINTERACTIVE 2020-09-29 10:12:03 +02:00
c460d4c743
Update bindists for Mint to fedora 2020-09-29 00:22:58 +02:00
5294adf0d7
Fix bootstrap-script 2020-09-28 23:52:23 +02:00
00f3fa35fd
Add hls installation to bootstrap-haskell 2020-09-28 23:48:59 +02:00
9c9aa4f9c0
Fix CI 2020-09-28 23:27:15 +02:00
e23a187cc4
Add ghc-9.0.1-alpha1 2020-09-28 23:23:11 +02:00
3e429945dc
Also modify .bash_profile on mac 2020-09-28 09:59:35 +02:00
8be2a8eed7
Update CHANGELOG date for 0.1.11 2020-09-23 09:53:44 +02:00
6b65167581
Update yaml files 2020-09-23 00:27:28 +02:00
9d7914e69a
Bump ghcupURL 2020-09-22 23:41:19 +02:00
6c62884b24
Update Changelog 2020-09-22 21:31:01 +02:00
965d2a3ba8
Drop 'ghcup compile cabal'
Upstream has discontinued the old bootstrap shell script.
The new python shell script doesn't work like the old one
and is only useful for bootstrapping to a new architecture.

If you miss this feature, consider running:
  cabal install cabal-install

with the appropriate GHC version set (this might need some
experimenting).

This also fixes #64
2020-09-22 21:26:10 +02:00
40a1cc98c6
Drop use of table-layout, thanks to Simon 2020-09-22 21:05:59 +02:00
4c2d4ee6bd
Update hls tarballs 2020-09-22 19:23:24 +02:00
9276664465
Merge branch 'hls' into master 2020-09-22 15:23:10 +02:00
a94bcdb92d
Remove 9.0.1-alpha1
Ben requested removal, since this wasn't an announced
release.
2020-09-21 14:13:45 +02:00
5da5fabfef
Use alpine:3.12 instead of edge 2020-09-21 12:23:14 +02:00
05cc55c52d
Improve brick UI 2020-09-21 10:40:06 +02:00
571df1349c
Update hie.yaml 2020-09-20 23:09:09 +02:00
cbbb75062c
Bump version to 0.1.11 2020-09-20 23:09:09 +02:00
bb7c4205db
Allow to install haskell-language-server wrt #65 2020-09-20 23:09:09 +02:00
b2027f1625
Simplify installing GHC from custom bindist wrt #60 2020-09-19 11:52:12 +02:00
65945c87df
Update CHANGELOG 2020-09-19 11:51:48 +02:00
081582d3e1
Merge branch 'compile-overwrite' into master 2020-09-18 09:31:14 +02:00
bf240af518
Fix build
https://github.com/cjdev/text-conversions/pull/10
2020-09-17 22:18:03 +02:00
a269131e2d
Allow to compile over existing version, fixes #59 2020-09-17 21:21:16 +02:00
59ece98fdc
Fix bug in compileGHC cleanup logic 2020-09-17 21:20:38 +02:00
563924ff26
Fix gitlab CI 2020-09-15 22:22:15 +02:00
8ee3f55428
Fix test on i386 2020-09-15 21:59:56 +02:00
93c17607b5
Fix haddock build, fixes #62 2020-09-15 17:44:30 +02:00
8b4c239444
Add changelog entry for cabal-3.4.0.0-rc3 2020-09-15 15:43:07 +02:00
8bef17bf59
Add cabal-3.4.0.0-rc3 2020-09-15 15:38:10 +02:00
a649146a39
Add hspec tests to gitlab CI 2020-09-13 21:13:42 +02:00
9d6a5313ab
Add JSON roundtrip specs 2020-09-13 21:10:13 +02:00
de09c950d5
Improve requirements wording, fixes #56 2020-09-13 15:38:51 +02:00
47838b1bd9
Merge branch 'compile-bindist' into master 2020-09-13 13:30:28 +02:00
02b360e2a9
Create bindists when compiling GHC wrt #51 2020-09-12 23:47:12 +02:00
c10ab15e0c
Update cabal pre-release ot 3.4.0.0-rc2 2020-09-04 10:16:28 +02:00
46f3da1a94
Merge branch 'fix-symlink-support' into master 2020-09-01 21:07:42 +02:00
7ec9d90aab
Fix build with libarchive-3.0.0.0 2020-09-01 19:55:48 +02:00
326bf510c9
Fix Error when ~/.ghcup is a valid symlink
Fixes #49
2020-08-31 13:03:12 +02:00
ce3d1f4309
Add GHC-9.0.1-alpha1 2020-08-27 23:41:07 +02:00
b31ba883e4
Add vim integration section to README 2020-08-23 14:07:49 +02:00
e5d1c04616
Fix bootstrap-haskell for fish shell, fixes #48 2020-08-20 15:51:37 +02:00
34ff0ed9cf
Fix dlSubDir for GHC-8.10.2 on alpine wrt #47 2020-08-20 15:49:28 +02:00
85bd87d5f3
Clarify 2020-08-19 19:40:59 +02:00
8b274214af
Fix typo 2020-08-19 19:38:36 +02:00
069e3102f4
Fix anchor 2020-08-19 19:36:13 +02:00
8623b32721
Add "Install custom bindists" to README 2020-08-19 19:34:04 +02:00
6342e8edf0
Use 8.10.2 in gitlab CI 2020-08-15 23:54:50 +02:00
bbd8f0c84c
Add GHC-8.10.2 for alpine 32big 2020-08-15 23:34:05 +02:00
873c951d6e
Refactor chmod +x 2020-08-14 22:27:05 +02:00
d9c864d3c5
Make sure cabal is executable wrt #46 2020-08-14 22:07:39 +02:00
4280d7109a
Fix 3.4.0.0-rc1 urls wrt #46 2020-08-14 21:49:01 +02:00
c8855c068f
Update version in bootstrap-haskell 2020-08-14 20:36:14 +02:00
90503061e9
Add ghcup-0.1.10 2020-08-14 20:22:27 +02:00
672ebf6426
Bump version 2020-08-14 16:57:15 +02:00
fd76fde23a
Add cabal-3.4.0.0-rc1 2020-08-14 16:54:27 +02:00
e24c9a3ffe
Show stray cabals, fixes #45 2020-08-14 16:53:32 +02:00
2641d50c21
Update ghcup binaries 2020-08-14 09:42:41 +02:00
202f3ea3ba
Fix bug where setting non-installed GHC unsets current one 2020-08-13 20:40:09 +02:00
4f09e3ff7e
Update CHANGELOG 2020-08-13 17:01:09 +02:00
1148219130
Fix README 2020-08-12 10:13:18 +02:00
4b47800dfb
CHANGELOG fix 2020-08-11 22:38:22 +02:00
e2c4db9132
Rm unneeded note 2020-08-11 22:04:08 +02:00
90af68b211
Pre-release 0.1.9 2020-08-11 21:55:15 +02:00
80603662b4
Merge branch 'cabal-install-3.4.0.0-rc1' 2020-08-11 21:34:45 +02:00
d2c5d4dfd9
Test that we're not missing GHCup alpine 2020-08-11 20:23:15 +02:00
6f1b8b4041
Fix build on 32bit 2020-08-11 19:47:29 +02:00
f63b2bf744
Fix CI 2020-08-11 11:48:42 +02:00
71cb75c170
Update .gitignore 2020-08-10 22:28:02 +02:00
dac64f5718
Make TarDir backwardscompat 2020-08-10 22:28:02 +02:00
27b2d2ac7d
Fix cabal.project for cabal-3.4 2020-08-10 22:28:01 +02:00
47142dd376
Test on 32bit 2020-08-10 22:28:01 +02:00
d071a7e51b
Avoid duplicate edits to .bashrc etc 2020-08-10 22:28:01 +02:00
5c45884f5f
Allow to specify regex for subdir 2020-08-10 22:27:50 +02:00
cafedd73a2
Use Settings to avoid querying dirs every time 2020-08-10 21:52:30 +02:00
7163b77837
Only query directories once 2020-08-10 21:51:31 +02:00
122c54b51e
Refactor 2020-08-10 21:51:31 +02:00
b9d7d7d007
Fix licences in module haddock 2020-08-10 21:51:29 +02:00
9050c9792a
Improve bootstrap-haskell 2020-08-10 21:51:20 +02:00
aac8f760ad
Add xdg support wrt #39 2020-08-10 21:51:19 +02:00
7d334c18f5
Don't stop TUI on subcommand failure 2020-08-10 21:51:19 +02:00
86b0e4b31b
Fix cabalSet for pre-release versions 2020-08-10 21:51:19 +02:00
af811f3dbc
nub result in getInstalledCabals 2020-08-10 21:51:19 +02:00
d30d2ac8a5
Add cabal-install-3.4.0.0-rc1 2020-08-10 21:51:00 +02:00
86a4b10de6
Merge branch 'yaml' 2020-08-10 08:58:55 +02:00
cfa7049ab9
Merge branch 'CI' 2020-08-09 22:11:48 +02:00
391676e90a
Use yaml instead of pesky json 2020-08-09 21:56:11 +02:00
34e4ece8b5
Merge branch 'ghc-8.10.2' 2020-08-09 16:14:04 +02:00
cf6443d83f
Add GHC-8.10.2 2020-08-09 15:53:56 +02:00
846cf92fa4
Add GHC-8.10.2 2020-08-09 15:49:08 +02:00
ab568901f8
Try to build for El Capitan 2020-07-22 22:50:13 +02:00
bfda95c0d6
Fix haskus-utils-types build with GHC-8.10.1 2020-07-22 02:35:22 +02:00
fb1875ee5b
Doc fixes 2020-07-22 02:34:17 +02:00
185d4f869b
Remove unnecessary bundles 2020-07-22 01:37:15 +02:00
2ac8b61aa8
Fix bootstrap-haskell when ghcup is a broken script
Fixes #28
2020-07-22 01:25:12 +02:00
8739cb4656
Enable haddock building in CI 2020-07-22 01:11:37 +02:00
826900cc41
Improve documentation 2020-07-22 01:08:58 +02:00
ec6bbdbf06
Update ghcup binaries 2020-07-22 00:18:31 +02:00
15a188c501
Update FreeBSD 8.10.1 2020-07-22 00:17:14 +02:00
b5440fc7d2
Fix bug in installCabalBin 2020-07-21 23:10:47 +02:00
4b21adadf1
Release 0.1.8 2020-07-21 22:47:21 +02:00
78ae77780b
Fix bug in logging thread
It would die on newlines due to empty String blindness.
Also make sure takeMVar does not block.
2020-07-21 22:43:09 +02:00
ccb95bcbee
f custom 2020-07-21 22:42:39 +02:00
21ac670bbe
Update FreeBSD bindist 2020-07-21 21:08:41 +02:00
8b54dee66c
Merge branch 'CI-m' 2020-07-21 20:21:53 +02:00
dad926f3ba
Allow to specify custom bindist, fixes #14 2020-07-21 20:19:33 +02:00
a298d949b5
Remove FreeBSD workaround in CI 2020-07-21 19:00:10 +02:00
e1cf11f9d4
Add Alpine GHC 8.4.4 for 64bit 2020-07-21 01:18:03 +02:00
a046f16308
Remove libtinfo compat symlinks 2020-07-21 00:36:31 +02:00
97cd43792d
Set 8.8.4 as recommended GHC version 2020-07-21 00:31:02 +02:00
08693e6d3a
Add more alpine bindists 2020-07-21 00:29:46 +02:00
e2227da8d2
Update ghcup binaries 2020-07-21 00:02:14 +02:00
5f20e4c583
Bump versions in CI 2020-07-20 23:57:26 +02:00
f82f1a12dd
Update version in bootstrap-script 2020-07-20 23:04:11 +02:00
53148fd1c9
Release 0.1.7 2020-07-20 22:25:28 +02:00
8985101b2a
Use 8.8.4 for test build 2020-07-20 22:25:09 +02:00
d1949c8490
Use available bindists for release build 2020-07-20 22:24:21 +02:00
b7faae1203
Add more alpine bindists 2020-07-20 22:20:24 +02:00
b6a9d35c3e
Merge branch 'alpine-bindists' 2020-07-20 20:59:08 +02:00
6cb6c7a448
Install alpine bindists with --disable-ld-override 2020-07-20 20:48:22 +02:00
22a5ad739e
Don't try non-musl bindists for Alpine Linux 2020-07-20 20:47:45 +02:00
14c91bdd78
Merge branch 'libarchive-fix' 2020-07-20 20:34:54 +02:00
2c638cd2e2
Fix unpacking of bindists with hardinks pointing to themselves
https://github.com/vmchale/libarchive/issues/14
https://github.com/libarchive/libarchive/issues/1381
2020-07-20 20:34:36 +02:00
9e59f484e3
Fix alpine bindists 2020-07-20 20:30:47 +02:00
ac8419ecb2
Fix platform detection for i386 docker images wrt #37 2020-07-20 20:30:36 +02:00
3ecdb63063
Update tarballs 2020-07-19 00:50:57 +02:00
cfe24428fa
Only check for upgrades when not upgrading 2020-07-19 00:47:20 +02:00
677 changed files with 95973 additions and 193291 deletions

11
.editorconfig Normal file
View File

@ -0,0 +1,11 @@
root = true
[*]
end_of_line = LF
trim_trailing_whitespace = true
insert_final_newline = true
[*.hs]
indent_style = space
indent_size = 2
max_line_length = 80

4946
.github/ghc-8.10.3-linux.alpine.files vendored Normal file

File diff suppressed because it is too large Load Diff

8734
.github/ghc-8.10.3-linux.files vendored Normal file

File diff suppressed because it is too large Load Diff

10321
.github/ghc-8.10.3-windows.files vendored Normal file

File diff suppressed because it is too large Load Diff

37
.github/ghcup-run.files vendored Normal file
View File

@ -0,0 +1,37 @@
.
./cabal
./ghc
./ghc-8.10.7
./ghc-pkg
./ghc-pkg-8.10.7
./ghci
./ghci-8.10.7
./haddock
./haddock-8.10.7
./haskell-language-server-8.10.6
./haskell-language-server-8.10.6~1.6.1.0
./haskell-language-server-8.10.7
./haskell-language-server-8.10.7~1.6.1.0
./haskell-language-server-8.6.5
./haskell-language-server-8.6.5~1.6.1.0
./haskell-language-server-8.8.4
./haskell-language-server-8.8.4~1.6.1.0
./haskell-language-server-9.0.1
./haskell-language-server-9.0.1~1.6.1.0
./haskell-language-server-9.0.2
./haskell-language-server-9.0.2~1.6.1.0
./haskell-language-server-9.2.1
./haskell-language-server-9.2.1~1.6.1.0
./haskell-language-server-wrapper
./haskell-language-server-wrapper-1.6.1.0
./hp2ps
./hp2ps-8.10.7
./hpc
./hpc-8.10.7
./hsc2hs
./hsc2hs-8.10.7
./runghc
./runghc-8.10.7
./runhaskell
./runhaskell-8.10.7
./stack

31
.github/ghcup-run.files.alpine vendored Normal file
View File

@ -0,0 +1,31 @@
.
./cabal
./ghc
./ghc-8.10.7
./ghc-pkg
./ghc-pkg-8.10.7
./ghci
./ghci-8.10.7
./haddock
./haddock-8.10.7
./haskell-language-server-8.10.7
./haskell-language-server-8.10.7~1.6.1.0
./haskell-language-server-8.8.4
./haskell-language-server-8.8.4~1.6.1.0
./haskell-language-server-9.0.2
./haskell-language-server-9.0.2~1.6.1.0
./haskell-language-server-9.2.1
./haskell-language-server-9.2.1~1.6.1.0
./haskell-language-server-wrapper
./haskell-language-server-wrapper-1.6.1.0
./hp2ps
./hp2ps-8.10.7
./hpc
./hpc-8.10.7
./hsc2hs
./hsc2hs-8.10.7
./runghc
./runghc-8.10.7
./runhaskell
./runhaskell-8.10.7
./stack

81
.github/ghcup-run.files.windows vendored Normal file
View File

@ -0,0 +1,81 @@
.
./cabal.exe
./cabal.shim
./ghc-8.10.7.exe
./ghc-8.10.7.shim
./ghc-pkg-8.10.7.exe
./ghc-pkg-8.10.7.shim
./ghc-pkg.exe
./ghc-pkg.shim
./ghc.exe
./ghc.shim
./ghci-8.10.7.exe
./ghci-8.10.7.shim
./ghci.exe
./ghci.shim
./ghcii-8.10.7.sh-8.10.7.exe
./ghcii-8.10.7.sh-8.10.7.shim
./ghcii-8.10.7.sh.exe
./ghcii-8.10.7.sh.shim
./ghcii.sh-8.10.7.exe
./ghcii.sh-8.10.7.shim
./ghcii.sh.exe
./ghcii.sh.shim
./haddock-8.10.7.exe
./haddock-8.10.7.shim
./haddock.exe
./haddock.shim
./haskell-language-server-8.10.6.exe
./haskell-language-server-8.10.6.shim
./haskell-language-server-8.10.6~1.6.1.0.exe
./haskell-language-server-8.10.6~1.6.1.0.shim
./haskell-language-server-8.10.7.exe
./haskell-language-server-8.10.7.shim
./haskell-language-server-8.10.7~1.6.1.0.exe
./haskell-language-server-8.10.7~1.6.1.0.shim
./haskell-language-server-8.6.5.exe
./haskell-language-server-8.6.5.shim
./haskell-language-server-8.6.5~1.6.1.0.exe
./haskell-language-server-8.6.5~1.6.1.0.shim
./haskell-language-server-8.8.4.exe
./haskell-language-server-8.8.4.shim
./haskell-language-server-8.8.4~1.6.1.0.exe
./haskell-language-server-8.8.4~1.6.1.0.shim
./haskell-language-server-9.0.1.exe
./haskell-language-server-9.0.1.shim
./haskell-language-server-9.0.1~1.6.1.0.exe
./haskell-language-server-9.0.1~1.6.1.0.shim
./haskell-language-server-9.0.2.exe
./haskell-language-server-9.0.2.shim
./haskell-language-server-9.0.2~1.6.1.0.exe
./haskell-language-server-9.0.2~1.6.1.0.shim
./haskell-language-server-9.2.1.exe
./haskell-language-server-9.2.1.shim
./haskell-language-server-9.2.1~1.6.1.0.exe
./haskell-language-server-9.2.1~1.6.1.0.shim
./haskell-language-server-wrapper-1.6.1.0.exe
./haskell-language-server-wrapper-1.6.1.0.shim
./haskell-language-server-wrapper.exe
./haskell-language-server-wrapper.shim
./hp2ps-8.10.7.exe
./hp2ps-8.10.7.shim
./hp2ps.exe
./hp2ps.shim
./hpc-8.10.7.exe
./hpc-8.10.7.shim
./hpc.exe
./hpc.shim
./hsc2hs-8.10.7.exe
./hsc2hs-8.10.7.shim
./hsc2hs.exe
./hsc2hs.shim
./runghc-8.10.7.exe
./runghc-8.10.7.shim
./runghc.exe
./runghc.shim
./runhaskell-8.10.7.exe
./runhaskell-8.10.7.shim
./runhaskell.exe
./runhaskell.shim
./stack.exe
./stack.shim

109
.github/release.yaml vendored Normal file
View File

@ -0,0 +1,109 @@
name: Create Release
on:
push:
tags:
- 'v*'
jobs:
draft_release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes in this Release
- First Change
- Second Change
draft: true
prerelease: false
release-mac:
name: Create Release for macOS
needs: draft_release
runs-on: ${{ matrix.os }}
env:
MACOSX_DEPLOYMENT_TARGET: 10.13
strategy:
matrix:
os:
- macOS-10.15
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: haskell/actions/setup@v1.2
with:
ghc-version: 8.10.4
cabal-version: 3.4.0.0
- name: create ~/.local/bin
run: mkdir -p "$HOME/.local/bin"
shell: bash
- name: Add ~/.local/bin to PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash
- name: Update cabal cache
run: cabal update
shell: bash
- name: Install cabal dependencies
run: cabal build --only-dependencies
shell: bash
- name: Build
run: cabal build -w ghc-${GHC_VERSION} --constraint="zlib +bundled-c-zlib" --constraint="lzma +static" -ftui
shell: bash
- name: Install
run: cp "$(cabal list-bin exe:ghcup)" ~/.local/bin/ghcup
shell: bash
- name: Strip
run: strip ~/.local/bin/ghcup
shell: bash
- name: Run tests
run: cabal test --constraint="zlib +bundled-c-zlib" --constraint="lzma +static" all
shell: bash
- name: Install git
run: brew install git
- name: set HOME
run: echo "HOME=$HOME" >> $GITHUB_ENV
shell: bash
- name: Set ASSET_PATH
run: echo "ASSET_PATH=$HOME/.local/bin/ghcup" >> $GITHUB_ENV
shell: bash
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.draft_release.outputs.upload_url }}
asset_path: ${{ env.ASSET_PATH }}
asset_name: ghcup-${{ matrix.os }}
asset_content_type: application/octet-stream
- if: always()
uses: actions/upload-artifact@v2
with:
name: plan.json
path: ./dist-newstyle/cache/plan.json

18
.github/scripts/bootstrap.sh vendored Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -eux
. .github/scripts/env.sh
mkdir -p "$CI_PROJECT_DIR"/.local/bin
git describe --always
### build
./scripts/bootstrap/bootstrap-haskell
[ "$(ghc --numeric-version)" = "${BOOTSTRAP_HASKELL_GHC_VERSION}" ]
# https://github.com/actions/runner-images/issues/7061
[ "$(ghcup config | grep --color=never meta-mode)" = "meta-mode: Lax" ]

27
.github/scripts/brew.sh vendored Normal file
View File

@ -0,0 +1,27 @@
#!/bin/sh
set -eux
. .github/scripts/env.sh
if [ -e "$HOME/.brew" ] ; then
(
cd "$HOME/.brew"
git fetch --depth 1
git reset --hard origin/master
)
else
git clone --depth=1 https://github.com/Homebrew/brew "$HOME/.brew"
fi
export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$PATH"
mkdir -p $CI_PROJECT_DIR/.brew_cache
export HOMEBREW_CACHE=$CI_PROJECT_DIR/.brew_cache
mkdir -p $CI_PROJECT_DIR/.brew_logs
export HOMEBREW_LOGS=$CI_PROJECT_DIR/.brew_logs
mkdir -p /private/tmp/.brew_tmp
export HOMEBREW_TEMP=/private/tmp/.brew_tmp
brew update
brew install ${1+"$@"}

37
.github/scripts/build.sh vendored Normal file
View File

@ -0,0 +1,37 @@
#!/bin/sh
set -eux
. .github/scripts/common.sh
git_describe
# ensure ghcup
install_ghcup
# ensure cabal-cache
download_cabal_cache "$HOME/.local/bin/cabal-cache"
# install toolchain (if necessary)
ghcup -v install ghc --set --force "$GHC_VER"
ghcup -v install cabal --force "$CABAL_VER"
ghc --version
cabal --version
GHC="ghc-${GHC_VER}"
# build
ecabal update
build_with_cache --project-file=cabal.project.release -w "${GHC}" --enable-tests
# set up artifacts
mkdir -p out
binary=$(cabal --project-file=cabal.project.release list-bin ghcup)
binary_test=$(cabal --project-file=cabal.project.release list-bin ghcup-test)
binary_opttest=$(cabal --project-file=cabal.project.release list-bin ghcup-optparse-test)
ver=$("${binary}" --numeric-version)
strip_binary "${binary}"
cp "${binary}" "out/${ARTIFACT}-${ver}${ext}"
cp "${binary_test}" "out/test-${ARTIFACT}-${ver}${ext}"
cp "${binary_opttest}" "out/test-optparse-${ARTIFACT}-${ver}${ext}"
cp ./dist-newstyle/cache/plan.json "out/${ARTIFACT}.plan.json"

13
.github/scripts/cabal-cache.sh vendored Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
case "$(uname -s)" in
MSYS_*|MINGW*)
ext=".exe"
;;
*)
ext=""
;;
esac
echo "cabal-cache disabled (CABAL_CACHE_DISABLE set)"

174
.github/scripts/common.sh vendored Normal file
View File

@ -0,0 +1,174 @@
#!/bin/sh
. .github/scripts/env.sh
ecabal() {
cabal "$@"
}
nonfatal() {
"$@" || "$* failed"
}
sync_from() {
if [ "${RUNNER_OS}" != "Windows" ] ; then
cabal_store_path="$(dirname "$(cabal help user-config | tail -n 1 | xargs)")/store"
fi
cabal-cache.sh sync-from-archive \
--host-name-override=${S3_HOST} \
--host-port-override=443 \
--host-ssl-override=True \
--region us-west-2 \
$([ "${RUNNER_OS}" != "Windows" ] && echo --store-path="$cabal_store_path") \
--archive-uri "s3://ghcup-hs/${RUNNER_OS}-${ARCH}-${DISTRO}"
}
sync_to() {
if [ "${RUNNER_OS}" != "Windows" ] ; then
cabal_store_path="$(dirname "$(cabal help user-config | tail -n 1 | xargs)")/store"
fi
cabal-cache.sh sync-to-archive \
--host-name-override=${S3_HOST} \
--host-port-override=443 \
--host-ssl-override=True \
--region us-west-2 \
$([ "${RUNNER_OS}" != "Windows" ] && echo --store-path="$cabal_store_path") \
--archive-uri "s3://ghcup-hs/${RUNNER_OS}-${ARCH}-${DISTRO}"
}
raw_eghcup() {
"$GHCUP_BIN/ghcup${ext}" -v -c "$@"
}
eghcup() {
if [ "${OS}" = "Windows" ] ; then
"$GHCUP_BIN/ghcup${ext}" -c -s "file:${GITHUB_WORKSPACE//\\//}/data/metadata/ghcup-${JSON_VERSION}.yaml" "$@"
else
"$GHCUP_BIN/ghcup${ext}" -c -s "file://$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml" "$@"
fi
}
sha_sum() {
if [ "${OS}" = "FreeBSD" ] ; then
sha256 "$@"
else
sha256sum "$@"
fi
}
git_describe() {
git config --global --get-all safe.directory | grep '^\*$' || git config --global --add safe.directory "*"
git describe --always
}
download_cabal_cache() {
(
set -e
mkdir -p "$HOME/.local/bin"
dest="$HOME/.local/bin/cabal-cache"
url=""
exe=""
cd /tmp
case "${RUNNER_OS}" in
"Linux")
case "${ARCH}" in
"32") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/i386-linux-cabal-cache
;;
"64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/x86_64-linux-cabal-cache
;;
"ARM64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/aarch64-linux-cabal-cache
;;
"ARM") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/armv7-linux-cabal-cache
;;
esac
;;
"FreeBSD")
url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/x86_64-portbld-freebsd-cabal-cache
;;
"Windows")
exe=".exe"
url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/x86_64-mingw64-cabal-cache
;;
"macOS")
case "${ARCH}" in
"ARM64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/aarch64-apple-darwin-cabal-cache
;;
"64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental5/x86_64-apple-darwin-cabal-cache
;;
esac
;;
esac
if [ -n "${url}" ] ; then
case "${url##*.}" in
"gz")
curl -L -o - "${url}" | gunzip > cabal-cache${exe}
;;
*)
curl -o cabal-cache${exe} -L "${url}"
;;
esac
sha_sum cabal-cache${exe}
mv "cabal-cache${exe}" "${dest}${exe}"
chmod +x "${dest}${exe}"
fi
# install shell wrapper
cp "${CI_PROJECT_DIR}"/.github/scripts/cabal-cache.sh "$HOME"/.local/bin/
chmod +x "$HOME"/.local/bin/cabal-cache.sh
)
}
build_with_cache() {
ecabal configure "$@"
ecabal build --dependencies-only "$@" --dry-run
sync_from
ecabal build --dependencies-only "$@" || sync_to
sync_to
ecabal build "$@"
sync_to
}
install_ghcup() {
case "${RUNNER_OS}" in
"Linux")
case "${ARCH}" in
"ARM"*)
if command -v ghcup ; then
mkdir -p "$GHCUP_BIN"
cp "$(command -v ghcup)" "$GHCUP_BIN/ghcup${ext}"
else
install_ghcup_curl_sh
fi
;;
*) install_ghcup_curl_sh
;;
esac
;;
*) install_ghcup_curl_sh
;;
esac
}
install_ghcup_curl_sh() {
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 BOOTSTRAP_HASKELL_INSTALL_NO_STACK=yes sh
}
strip_binary() {
(
set -e
local binary=$1
case "$(uname -s)" in
"Darwin"|"darwin")
;;
MSYS_*|MINGW*)
;;
*)
strip -s "${binary}"
;;
esac
)
}

74
.github/scripts/cross.sh vendored Normal file
View File

@ -0,0 +1,74 @@
#!/usr/bin/env bash
set -ex
. .github/scripts/common.sh
run() {
"$@"
}
if [ "${OS}" = "Windows" ] ; then
GHCUP_DIR="${GHCUP_INSTALL_BASE_PREFIX}"/ghcup
else
GHCUP_DIR="${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup
fi
git_describe
rm -rf "${GHCUP_DIR}"
mkdir -p "${GHCUP_BIN}"
cp "out/${ARTIFACT}"-* "$GHCUP_BIN/ghcup${ext}"
cp "out/test-${ARTIFACT}"-* "ghcup-test${ext}"
chmod +x "$GHCUP_BIN/ghcup${ext}"
chmod +x "ghcup-test${ext}"
"$GHCUP_BIN/ghcup${ext}" --version
eghcup --version
sha_sum "$GHCUP_BIN/ghcup${ext}"
sha_sum "$(raw_eghcup --offline whereis ghcup)"
### cross build
eghcup --numeric-version
eghcup install ghc "${GHC_VER}"
eghcup set ghc "${GHC_VER}"
eghcup install cabal "${CABAL_VER}"
cabal --version
eghcup debug-info
ecabal update
"${WRAPPER}" "$GHCUP_BIN/ghcup${ext}" -c -s "file://$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml" -v \
compile ghc \
$(if [ -n "${HADRIAN_FLAVOUR}" ] ; then printf "%s" "--flavour=${HADRIAN_FLAVOUR}" ; else true ; fi) \
-j "$(nproc)" \
-v "${GHC_TARGET_VERSION}" \
-b "${GHC_VER}" \
-x "${CROSS}" \
-- ${BUILD_CONF_ARGS}
eghcup set ghc "${CROSS}-${GHC_TARGET_VERSION}"
[ "$($(eghcup whereis ghc "${CROSS}-${GHC_TARGET_VERSION}") --numeric-version)" = "${GHC_TARGET_VERSION}" ]
# test that doing fishy symlinks into GHCup dir doesn't cause weird stuff on 'ghcup nuke'
mkdir no_nuke/
mkdir no_nuke/bar
echo 'foo' > no_nuke/file
echo 'bar' > no_nuke/bar/file
ln -s "$CI_PROJECT_DIR"/no_nuke/ "${GHCUP_DIR}"/cache/no_nuke
ln -s "$CI_PROJECT_DIR"/no_nuke/ "${GHCUP_DIR}"/logs/no_nuke
# nuke
eghcup nuke
[ ! -e "${GHCUP_DIR}" ]
# make sure nuke doesn't resolve symlinks
[ -e "$CI_PROJECT_DIR"/no_nuke/file ]
[ -e "$CI_PROJECT_DIR"/no_nuke/bar/file ]

34
.github/scripts/env.sh vendored Normal file
View File

@ -0,0 +1,34 @@
#!/bin/sh
if [ "${RUNNER_OS}" = "Windows" ] ; then
ext=".exe"
else
ext=''
fi
export DEBIAN_FRONTEND=noninteractive
export TZ=Asia/Singapore
if [ "${RUNNER_OS}" = "freebsd" ] ; then
export RUNNER_OS=FreeBSD
fi
export OS="$RUNNER_OS"
export PATH="$HOME/.local/bin:$PATH"
if [ "${RUNNER_OS}" = "Windows" ] ; then
# on windows use pwd to get unix style path
CI_PROJECT_DIR="$(pwd)"
export CI_PROJECT_DIR
export GHCUP_INSTALL_BASE_PREFIX="/c"
export GHCUP_BIN="$GHCUP_INSTALL_BASE_PREFIX/ghcup/bin"
export PATH="$GHCUP_BIN:$PATH"
export CABAL_DIR="C:\\Users\\runneradmin\\AppData\\Roaming\\cabal"
else
export CI_PROJECT_DIR="${GITHUB_WORKSPACE}"
export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR"
export GHCUP_BIN="$GHCUP_INSTALL_BASE_PREFIX/.ghcup/bin"
export PATH="$GHCUP_BIN:$PATH"
export CABAL_DIR="$CI_PROJECT_DIR/cabal"
export CABAL_CACHE="$CI_PROJECT_DIR/cabal-cache"
fi

72
.github/scripts/hls.sh vendored Normal file
View File

@ -0,0 +1,72 @@
#!/usr/bin/env bash
set -eux
. .github/scripts/common.sh
mkdir -p "$CI_PROJECT_DIR"/.local/bin
### build
if [ "${OS}" = "Windows" ] ; then
GHCUP_DIR="${GHCUP_INSTALL_BASE_PREFIX}"/ghcup
else
GHCUP_DIR="${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup
fi
rm -rf "${GHCUP_DIR}"
mkdir -p "${GHCUP_BIN}"
ls -lah out
find out
cp "out/${ARTIFACT}"-* "$GHCUP_BIN/ghcup${ext}"
chmod +x "$GHCUP_BIN/ghcup${ext}"
echo "$PATH"
"$GHCUP_BIN/ghcup${ext}" --version
eghcup --version
sha_sum "$GHCUP_BIN/ghcup${ext}"
sha_sum "$(raw_eghcup --offline whereis ghcup)"
git_describe
eghcup install ghc "${GHC_VERSION}"
eghcup install cabal "${CABAL_VERSION}"
ecabal update
if ! command -v cabal-cache ; then
download_cabal_cache "$HOME/.local/bin/cabal-cache"
fi
if ! cabal-cache version ; then
build_cabal_cache "$HOME/.local/bin"
fi
eghcup debug-info
(
cd /tmp
git clone --depth 1 --branch "${HLS_TARGET_VERSION}" \
https://github.com/haskell/haskell-language-server.git \
"haskell-language-server-${HLS_TARGET_VERSION}"
cd "haskell-language-server-${HLS_TARGET_VERSION}/"
ecabal configure -w "ghc-${GHC_VERSION}" --disable-profiling --disable-tests --jobs="$(nproc)"
ecabal build --dependencies-only -w "ghc-${GHC_VERSION}" --disable-profiling --disable-tests --jobs="$(nproc)" --dry-run
sync_from
ecabal build --dependencies-only -w "ghc-${GHC_VERSION}" --disable-profiling --disable-tests --jobs="$(nproc)" || sync_to
sync_to
)
eghcup -v compile hls -j "$(nproc)" -g "${HLS_TARGET_VERSION}" --ghc "${GHC_VERSION}"
[ "$($(eghcup whereis hls "${HLS_TARGET_VERSION}") --numeric-version)" = "${HLS_TARGET_VERSION}" ] ||
[ "$($(eghcup whereis hls "${HLS_TARGET_VERSION}") --numeric-version | sed 's/.0$//')" = "${HLS_TARGET_VERSION}" ]
# nuke
eghcup nuke
[ ! -e "${GHCUP_DIR}" ]

272
.github/scripts/test.sh vendored Normal file
View File

@ -0,0 +1,272 @@
#!/usr/bin/env bash
set -eux
. .github/scripts/common.sh
if [ "${OS}" = "Windows" ] ; then
GHCUP_DIR="${GHCUP_INSTALL_BASE_PREFIX}"/ghcup
else
GHCUP_DIR="${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup
fi
env
git_describe
rm -rf "${GHCUP_DIR}"
mkdir -p "${GHCUP_BIN}"
cp "out/${ARTIFACT}"-* "$GHCUP_BIN/ghcup${ext}"
cp "out/test-${ARTIFACT}"-* "ghcup-test${ext}"
cp "out/test-optparse-${ARTIFACT}"-* "ghcup-test-optparse${ext}"
chmod +x "$GHCUP_BIN/ghcup${ext}"
chmod +x "ghcup-test${ext}"
chmod +x "ghcup-test-optparse${ext}"
"$GHCUP_BIN/ghcup${ext}" --version
eghcup --version
sha_sum "$GHCUP_BIN/ghcup${ext}"
sha_sum "$(raw_eghcup --offline whereis ghcup)"
### Haskell test suite
./"ghcup-test${ext}"
./"ghcup-test-optparse${ext}"
rm "ghcup-test${ext}" "ghcup-test-optparse${ext}"
### manual cli based testing
eghcup --numeric-version
# test PATH on windows wrt msys2
# https://github.com/haskell/ghcup-hs/pull/992/checks
if [ "${OS}" = "Windows" ] ; then
eghcup run -m -- sh -c 'echo $PATH' | sed 's/:/\n/' | grep '^/mingw64/bin$'
fi
eghcup install ghc "${GHC_VER}"
eghcup unset ghc "${GHC_VER}"
ls -lah "$(eghcup whereis -d ghc "${GHC_VER}")"
[ "$($(eghcup whereis ghc "${GHC_VER}") --numeric-version)" = "${GHC_VER}" ]
[ "$(eghcup run -q --ghc "${GHC_VER}" -- ghc --numeric-version)" = "${GHC_VER}" ]
[ "$(ghcup run -q --ghc "${GHC_VER}" -- ghc -e 'Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)')" = "$($(ghcup whereis ghc "${GHC_VER}") -e 'Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)')" ]
eghcup set ghc "${GHC_VER}"
eghcup install cabal "${CABAL_VER}"
[ "$($(eghcup whereis cabal "${CABAL_VER}") --numeric-version)" = "${CABAL_VER}" ]
eghcup unset cabal
"$GHCUP_BIN"/cabal --version && exit 1 || echo yes
# make sure no cabal is set when running 'ghcup run' to check that PATH propagages properly
# https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/375
[ "$(eghcup run -q --cabal "${CABAL_VER}" -- cabal --numeric-version)" = "${CABAL_VER}" ]
eghcup set cabal "${CABAL_VER}"
[ "$($(eghcup whereis cabal "${CABAL_VER}") --numeric-version)" = "${CABAL_VER}" ]
if [ "${OS}" != "FreeBSD" ] ; then
if [ "${ARCH}" = "64" ] && [ "${DISTRO}" != "Alpine" ] ; then
eghcup run --ghc 8.10.7 --cabal 3.4.1.0 --hls 1.6.1.0 --stack 2.7.3 --install --bindir "$(pwd)/.bin"
if [ "${OS}" = "Windows" ] ; then
cat "$( cd "$(dirname "$0")" ; pwd -P )/../ghcup-run.files.windows" | sort > expected.txt
elif [ "${DISTRO}" = "Alpine" ] ; then
cat "$( cd "$(dirname "$0")" ; pwd -P )/../ghcup-run.files.alpine" | sort > expected.txt
else
cat "$( cd "$(dirname "$0")" ; pwd -P )/../ghcup-run.files" | sort > expected.txt
fi
(cd ".bin" && find . | sort) > actual.txt
diff --strip-trailing-cr -w -u actual.txt expected.txt
rm actual.txt expected.txt
rm -rf .bin
fi
fi
cabal --version
eghcup debug-info
# also test etags
eghcup list
eghcup list -t ghc
eghcup list -t cabal
ghc_ver=$(ghc --numeric-version)
ghc --version
"ghc-${ghc_ver}" --version
if [ "${OS}" != "Windows" ] ; then
ghci --version
"ghci-${ghc_ver}" --version
fi
if [ "${OS}" = "macOS" ] && [ "${ARCH}" = "ARM64" ] ; then
# missing bindists
echo
elif [ "${OS}" = "FreeBSD" ] ; then
# not enough space
echo
else
# test installing new ghc doesn't mess with currently set GHC
# https://gitlab.haskell.org/haskell/ghcup-hs/issues/7
if [ "${OS}" = "Linux" ] ; then
eghcup --downloader=wget prefetch ghc 8.10.3
eghcup --offline install ghc 8.10.3
if [ "${ARCH}" = "64" ] ; then
if [ "${DISTRO}" = "Alpine" ] ; then
(cat "$( cd "$(dirname "$0")" ; pwd -P )/../ghc-8.10.3-linux.alpine.files" | sort) > expected.txt
else
(cat "$( cd "$(dirname "$0")" ; pwd -P )/../ghc-8.10.3-linux.files" | sort) > expected.txt
fi
(cd "${GHCUP_DIR}/ghc/8.10.3/" && find . | sort) > actual.txt
# ignore docs
sed -i '/share\/doc/d' actual.txt
sed -i '/share\/doc/d' expected.txt
diff --strip-trailing-cr -w -u actual.txt expected.txt
rm actual.txt expected.txt
fi
elif [ "${OS}" = "Windows" ] ; then
eghcup prefetch ghc 8.10.3
eghcup --offline install ghc 8.10.3
(cat "$( cd "$(dirname "$0")" ; pwd -P )/../ghc-8.10.3-windows.files" | sort) > expected.txt
(cd "${GHCUP_DIR}/ghc/8.10.3/" && find . | sort) > actual.txt
diff --strip-trailing-cr -w -u actual.txt expected.txt
rm actual.txt expected.txt
else
eghcup prefetch ghc 8.10.3
eghcup --offline install ghc 8.10.3
fi
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
eghcup --offline set 8.10.3
eghcup set 8.10.3
[ "$(ghc --numeric-version)" = "8.10.3" ]
eghcup set "${GHC_VER}"
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
eghcup unset ghc
"$GHCUP_BIN"/ghc --numeric-version && exit 1 || echo yes
eghcup set "${GHC_VER}"
eghcup --offline rm 8.10.3
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
ls -lah "$GHCUP_BIN"
if [ "${OS}" = "macOS" ] ; then
eghcup install hls
$(eghcup whereis hls) --version
eghcup install stack
$(eghcup whereis stack) --version
elif [ "${OS}" = "Linux" ] ; then
if [ "${ARCH}" = "64" ] && [ "${DISTRO}" != "Alpine" ] ; then
eghcup install hls
haskell-language-server-wrapper --version
eghcup unset hls
"$GHCUP_BIN"/haskell-language-server-wrapper --version && exit 1 || echo yes
eghcup install stack
stack --version
eghcup unset stack
"$GHCUP_BIN"/stack --version && exit 1 || echo yes
fi
fi
fi
# check that lazy loading works for 'whereis'
cp "$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml" "$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml.bak"
echo '**' > "$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml"
eghcup whereis ghc "$(ghc --numeric-version)"
mv -f "$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml.bak" "$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml"
eghcup rm "$(ghc --numeric-version)"
# https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/116
if [ "${OS}" = "Linux" ] ; then
if [ "${ARCH}" = "64" ] ; then
eghcup install cabal -u https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal/3.7.0.0-pre20220407/cabal-install-3.7-x86_64-linux-alpine.tar.xz 3.4.0.0-rc4
eghcup rm cabal 3.4.0.0-rc4
fi
fi
eghcup gc -c
# test etags
rm -f "${GHCUP_DIR}/cache/ghcup-${JSON_VERSION}.yaml"
raw_eghcup -s "https://www.haskell.org/ghcup/data/ghcup-${JSON_VERSION}.yaml" list
# snapshot yaml and etags file
etag=$(cat "${GHCUP_DIR}/cache/ghcup-${JSON_VERSION}.yaml.etags")
sha=$(sha_sum "${GHCUP_DIR}/cache/ghcup-${JSON_VERSION}.yaml")
# invalidate access time timer, which is 5minutes, so we re-download
touch -a -m -t '199901010101' "${GHCUP_DIR}/cache/ghcup-${JSON_VERSION}.yaml"
# redownload same file with some newlines added
raw_eghcup -s https://raw.githubusercontent.com/haskell/ghcup-metadata/exp/ghcup-${JSON_VERSION}.yaml list
# snapshot new yaml and etags file
etag2=$(cat "${GHCUP_DIR}/cache/ghcup-${JSON_VERSION}.yaml.etags")
sha2=$(sha_sum "${GHCUP_DIR}/cache/ghcup-${JSON_VERSION}.yaml")
# compare
[ "${etag}" != "${etag2}" ]
[ "${sha}" != "${sha2}" ]
# invalidate access time timer, which is 5minutes, but don't expect a re-download
touch -a -m -t '199901010101' "${GHCUP_DIR}/cache/ghcup-${JSON_VERSION}.yaml"
# this time, we expect the same hash and etag
raw_eghcup -s https://raw.githubusercontent.com/haskell/ghcup-metadata/exp/ghcup-${JSON_VERSION}.yaml list
etag3=$(cat "${GHCUP_DIR}/cache/ghcup-${JSON_VERSION}.yaml.etags")
sha3=$(sha_sum "${GHCUP_DIR}/cache/ghcup-${JSON_VERSION}.yaml")
[ "${etag2}" = "${etag3}" ]
[ "${sha2}" = "${sha3}" ]
# test isolated installs
if [ "${DISTRO}" != "Alpine" ] ; then
eghcup install ghc -i "$(pwd)/isolated" 8.10.5
[ "$(isolated/bin/ghc --numeric-version)" = "8.10.5" ]
! eghcup install ghc -i "$(pwd)/isolated" 8.10.5
if [ "${ARCH}" = "64" ] ; then
if [ "${OS}" = "Linux" ] || [ "${OS}" = "Windows" ] ; then
eghcup install cabal -i "$(pwd)/isolated" 3.4.0.0
[ "$(isolated/cabal --numeric-version)" = "3.4.0.0" ]
eghcup install stack -i "$(pwd)/isolated" 2.7.3
[ "$(isolated/stack --numeric-version)" = "2.7.3" ]
eghcup install hls -i "$(pwd)/isolated" 1.3.0
[ "$(isolated/haskell-language-server-wrapper --numeric-version)" = "1.3.0" ] ||
[ "$(isolated/haskell-language-server-wrapper --numeric-version)" = "1.3.0.0" ]
# test that isolated installs don't clean up target directory
cat <<EOF > "${GHCUP_BIN}/gmake"
#!/bin/bash
exit 1
EOF
chmod +x "${GHCUP_BIN}/gmake"
mkdir isolated_tainted/
touch isolated_tainted/lol
! eghcup install ghc -i "$(pwd)/isolated_tainted" 8.10.5 --force
[ -e "$(pwd)/isolated_tainted/lol" ]
rm "${GHCUP_BIN}/gmake"
fi
fi
fi
eghcup upgrade
eghcup upgrade -f
# restore old ghcup, because we want to test nuke
cp "out/${ARTIFACT}"-* "$GHCUP_BIN/ghcup${ext}"
chmod +x "$GHCUP_BIN/ghcup${ext}"
# test that doing fishy symlinks into GHCup dir doesn't cause weird stuff on 'ghcup nuke'
mkdir no_nuke/
mkdir no_nuke/bar
echo 'foo' > no_nuke/file
echo 'bar' > no_nuke/bar/file
ln -s "$CI_PROJECT_DIR"/no_nuke/ "${GHCUP_DIR}"/cache/no_nuke
ln -s "$CI_PROJECT_DIR"/no_nuke/ "${GHCUP_DIR}"/logs/no_nuke
# nuke
eghcup nuke
[ ! -e "${GHCUP_DIR}" ]
# make sure nuke doesn't resolve symlinks
[ -e "$CI_PROJECT_DIR"/no_nuke/file ]
[ -e "$CI_PROJECT_DIR"/no_nuke/bar/file ]

60
.github/workflows/bootstrap.yaml vendored Normal file
View File

@ -0,0 +1,60 @@
name: Bootstrap tests
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master
jobs:
bootstrap:
name: bootstrap
runs-on: ${{ matrix.os }}
env:
BOOTSTRAP_HASKELL_CABAL_VERSION: 3.6.2.0
BOOTSTRAP_HASKELL_GHC_VERSION: 8.10.7
BOOTSTRAP_HASKELL_NONINTERACTIVE: yes
ARCH: 64
JSON_VERSION: "0.0.7"
strategy:
matrix:
include:
- os: ubuntu-latest
DISTRO: Ubuntu
- os: macOS-11
DISTRO: na
- os: windows-latest
DISTRO: na
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: 'true'
- if: runner.os == 'Linux'
name: Run bootstrap
run: |
sudo apt-get install -y libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl gzip
sh ./.github/scripts/bootstrap.sh
env:
DISTRO: ${{ matrix.DISTRO }}
- if: runner.os == 'macOS'
name: Run bootstrap
run: sh ./.github/scripts/bootstrap.sh
env:
DISTRO: ${{ matrix.DISTRO }}
- if: runner.os == 'Windows'
name: Run bootstrap
run: |
$ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop
$curDir = Get-Location
Write-Host "Current Working Directory: $curDir"
./scripts/bootstrap/bootstrap-haskell.ps1 -InstallDir ${GITHUB_WORKSPACE} -BootstrapUrl ("{0}/scripts/bootstrap/bootstrap-haskell" -f $curDir) -InBash -Msys2Env "MINGW64"
shell: pwsh

39
.github/workflows/cabal.project.yaml vendored Normal file
View File

@ -0,0 +1,39 @@
name: Test cabal.project files
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master
schedule:
- cron: '0 2 * * *'
jobs:
build:
name: Build binary
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macOS-latest, macOS-11, windows-latest, ubuntu-latest]
ghc: ["8.10.7", "9.0.2", "9.2.8", "9.4.8"]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run build
run: |
env
ghcup --version
ghcup run -i --cabal latest -- cabal update
ghcup run -i --cabal latest --ghc ${GHC_VER} -- cabal build --project-file=cabal.ghc${GHC_VER//./}.project
env:
GHC_VER: ${{ matrix.ghc }}
shell: bash

37
.github/workflows/cache.yaml vendored Normal file
View File

@ -0,0 +1,37 @@
name: Cache eviction
on:
workflow_dispatch:
inputs:
key:
description: Which cache to evict
required: true
default: '/'
type: choice
options:
- FreeBSD-64-na
- Linux-32-Alpine
- Linux-64-Alpine
- Linux-64-Ubuntu
- Linux-ARM-Ubuntu
- Linux-ARM64-Ubuntu
- Windows-64-na
- macOS-64-na
- macOS-ARM64-na
- /
jobs:
evict:
runs-on: ubuntu-latest
steps:
- name: Remove from S3
uses: vitorsgomes/s3-rm-action@master
with:
args: --recursive
env:
AWS_S3_ENDPOINT: https://${{ secrets.S3_HOST }}
AWS_S3_BUCKET: ghcup-hs
AWS_REGION: us-west-2
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
PATH_TO_DELETE: ${{ github.event.inputs.key }}

147
.github/workflows/cross.yaml vendored Normal file
View File

@ -0,0 +1,147 @@
name: Test cross bindists
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master
schedule:
- cron: '0 2 * * *'
env:
CABAL_CACHE_DISABLE: ${{ vars.CABAL_CACHE_DISABLE }}
CABAL_CACHE_NONFATAL: yes
jobs:
build:
name: Build linux binary
runs-on: [self-hosted, Linux, X64, maerwald]
env:
CABAL_VER: 3.10.3.0
JSON_VERSION: "0.0.8"
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
S3_HOST: ${{ secrets.S3_HOST }}
ARTIFACT: "x86_64-linux-ghcup"
GHC_VER: 8.10.7
ARCH: 64
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run build
uses: docker://hasufell/alpine-haskell:3.12
with:
args: sh .github/scripts/build.sh
env:
ARTIFACT: ${{ env.ARTIFACT }}
ARCH: ${{ env.ARCH }}
GHC_VER: ${{ env.GHC_VER }}
DISTRO: Alpine
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
S3_HOST: ${{ env.S3_HOST }}
- if: always()
name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: artifacts
path: |
./out/*
test-cross-linux:
name: Test linux cross
needs: "build"
runs-on: [self-hosted, Linux, X64]
container:
image: registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb12:a9297a370025101b479cfd4977f8f910814e03ab
options: --user root
env:
CABAL_VER: 3.10.3.0
BUILD_CONF_ARGS: "--enable-unregisterised"
HADRIAN_FLAVOUR: ""
JSON_VERSION: "0.0.8"
GHC_VER: 8.10.6
GHC_TARGET_VERSION: "8.10.7"
ARCH: 64
DISTRO: Debian
ARTIFACT: "x86_64-linux-ghcup"
CROSS: "arm-linux-gnueabihf"
WRAPPER: "run"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/download-artifact@v4
with:
name: artifacts
path: ./out
- name: Run test (64 bit linux)
run: |
sudo apt-get update -y
sudo apt-get install -y libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl gzip libstdc++-11-dev
sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
sudo dpkg --add-architecture armhf
sudo apt-get update -y
sudo apt-get install -y libncurses-dev:armhf libstdc++-11-dev:armhf
# ld.bfd is broken on armv7: https://sourceware.org/bugzilla/show_bug.cgi?id=16177
update-alternatives --install "/usr/bin/x86_64-linux-gnu-ld" "ld" "/usr/bin/x86_64-linux-gnu-ld.gold" 20
update-alternatives --install "/usr/bin/x86_64-linux-gnu-ld" "ld" "/usr/bin/x86_64-linux-gnu-ld.bfd" 10
update-alternatives --set "ld" "/usr/bin/x86_64-linux-gnu-ld.gold"
update-alternatives --install "/usr/bin/arm-linux-gnueabihf-ld" "ld-arm" "/usr/bin/arm-linux-gnueabihf-ld.gold" 20
update-alternatives --install "/usr/bin/arm-linux-gnueabihf-ld" "ld-arm" "/usr/bin/arm-linux-gnueabihf-ld.bfd" 10
update-alternatives --set "ld-arm" "/usr/bin/arm-linux-gnueabihf-ld.gold"
sh .github/scripts/cross.sh
test-cross-js:
name: Test GHC JS cross
needs: "build"
runs-on: [self-hosted, Linux, X64]
container:
image: registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb12:a9297a370025101b479cfd4977f8f910814e03ab
options: --user root
env:
CABAL_VER: 3.10.3.0
BUILD_CONF_ARGS: ""
HADRIAN_FLAVOUR: "default+native_bignum"
JSON_VERSION: "0.0.8"
GHC_VER: 9.6.2
GHC_TARGET_VERSION: "9.6.2"
ARCH: 64
DISTRO: Debian
ARTIFACT: "x86_64-linux-ghcup"
CROSS: "javascript-unknown-ghcjs"
WRAPPER: "emconfigure"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/download-artifact@v4
with:
name: artifacts
path: ./out
- name: Run test (64 bit linux)
run: |
sudo apt-get update -y
sudo apt-get install -y libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl gzip
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
. ./emsdk_env.sh
cd ..
bash .github/scripts/cross.sh

127
.github/workflows/docker.yaml vendored Normal file
View File

@ -0,0 +1,127 @@
name: Docker image builds
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
docker-alpine32:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push (alpine 32bit)
uses: docker/build-push-action@v3
with:
context: ./docker/alpine32
push: true
tags: hasufell/i386-alpine-haskell:3.12
platforms: |
linux/i386
linux/amd64
docker-alpine:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push (alpine 64bit)
uses: docker/build-push-action@v3
with:
context: ./docker/alpine64
push: true
tags: hasufell/alpine-haskell:3.12
platforms: linux/amd64
docker-arm32:
runs-on: [self-hosted, Linux, ARM64]
steps:
- uses: docker://arm64v8/ubuntu:focal
name: Cleanup (aarch64 linux)
continue-on-error: true
with:
args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +"
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push (debian buster)
uses: docker/build-push-action@v3
with:
context: ./docker/arm32v7/buster
push: true
tags: hasufell/arm32v7-debian-haskell:10
platforms: linux/arm
- name: Build and push (ubuntu focal)
uses: docker/build-push-action@v3
with:
context: ./docker/arm32v7/focal
push: true
tags: hasufell/arm32v7-ubuntu-haskell:focal
platforms: linux/arm
docker-aarch:
runs-on: [self-hosted, Linux, ARM64]
steps:
- uses: docker://arm64v8/ubuntu:focal
name: Cleanup (aarch64 linux)
continue-on-error: true
with:
args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +"
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push (debian buster)
uses: docker/build-push-action@v3
with:
context: ./docker/arm64v8/buster
push: true
tags: hasufell/arm64v8-debian-haskell:10
platforms: linux/arm64
- name: Build and push (ubuntu focal)
uses: docker/build-push-action@v3
with:
context: ./docker/arm64v8/focal
push: true
tags: hasufell/arm64v8-ubuntu-haskell:focal
platforms: linux/arm64

26
.github/workflows/hlint.yaml vendored Normal file
View File

@ -0,0 +1,26 @@
name: Hlint
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master
jobs:
hlint:
name: hlint
runs-on: ubuntu-latest
env:
JSON_VERSION: "0.0.7"
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Run hlint
run: curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s -- -r lib/ test/

33
.github/workflows/mkdocs.yaml vendored Normal file
View File

@ -0,0 +1,33 @@
name: MkDocs
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master
jobs:
mkdocs:
name: mkdocs
runs-on: ubuntu-latest
env:
JSON_VERSION: "0.0.7"
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Install mkdocs deps
run: |
sudo apt-get update -y
sudo apt-get install -y python3-pip
sudo pip3 install mkdocs
- name: Run mkdocs
run: |
mkdocs build

581
.github/workflows/release.yaml vendored Normal file
View File

@ -0,0 +1,581 @@
name: Build and release
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master
schedule:
- cron: '0 2 * * *'
env:
CABAL_CACHE_DISABLE: ${{ vars.CABAL_CACHE_DISABLE }}
CABAL_CACHE_NONFATAL: yes
jobs:
build-linux:
name: Build linux binary
runs-on: ${{ matrix.os }}
env:
CABAL_VER: 3.10.2.0
JSON_VERSION: "0.0.8"
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
S3_HOST: ${{ secrets.S3_HOST }}
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-latest
ARTIFACT: "i386-linux-ghcup"
GHC_VER: 8.10.7
ARCH: 32
- os: ubuntu-latest
ARTIFACT: "x86_64-linux-ghcup"
GHC_VER: 9.4.8
ARCH: 64
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- if: matrix.ARCH == '32'
name: Run build (32 bit linux)
uses: docker://hasufell/i386-alpine-haskell:3.12
with:
args: sh .github/scripts/build.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: Alpine
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
S3_HOST: ${{ env.S3_HOST }}
- if: matrix.ARCH == '64'
name: Run build (64 bit linux)
uses: docker://hasufell/alpine-haskell:3.12
with:
args: sh .github/scripts/build.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: Alpine
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
S3_HOST: ${{ env.S3_HOST }}
- if: always()
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
./out/*
build-arm:
name: Build ARM binary
runs-on: ${{ matrix.os }}
env:
CABAL_VER: 3.6.2.0
JSON_VERSION: "0.0.8"
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
S3_HOST: ${{ secrets.S3_HOST }}
strategy:
fail-fast: true
matrix:
include:
- os: [self-hosted, Linux, ARM64, maerwald]
ARTIFACT: "armv7-linux-ghcup"
GHC_VER: 9.2.8
ARCH: ARM
- os: [self-hosted, Linux, ARM64, maerwald]
ARTIFACT: "aarch64-linux-ghcup"
GHC_VER: 9.4.8
ARCH: ARM64
steps:
- name: git config
run: |
git config --global --get-all safe.directory | grep '^\*$' || git config --global --add safe.directory "*"
shell: bash
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- if: matrix.ARCH == 'ARM'
uses: docker://hasufell/arm32v7-debian-haskell:10
name: Run build (armv7 linux)
with:
args: sh .github/scripts/build.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: Ubuntu
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
S3_HOST: ${{ env.S3_HOST }}
LD: ld.gold
- if: matrix.ARCH == 'ARM64'
uses: docker://hasufell/arm64v8-debian-haskell:10
name: Run build (aarch64 linux)
with:
args: sh .github/scripts/build.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: Ubuntu
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
S3_HOST: ${{ env.S3_HOST }}
- if: always()
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
./out/*
build-macwin:
name: Build binary (Mac/Win)
runs-on: ${{ matrix.os }}
env:
CABAL_VER: 3.10.2.0
MACOSX_DEPLOYMENT_TARGET: 10.13
JSON_VERSION: "0.0.8"
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
S3_HOST: ${{ secrets.S3_HOST }}
strategy:
fail-fast: false
matrix:
include:
- os: [self-hosted, macOS, ARM64]
ARTIFACT: "aarch64-apple-darwin-ghcup"
GHC_VER: 9.4.8
ARCH: ARM64
- os: macOS-11
ARTIFACT: "x86_64-apple-darwin-ghcup"
GHC_VER: 9.4.8
ARCH: 64
- os: windows-latest
ARTIFACT: "x86_64-mingw64-ghcup"
GHC_VER: 9.4.8
ARCH: 64
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- if: matrix.ARCH == 'ARM64' && runner.os == 'macOS'
name: Run build
run: |
bash .github/scripts/brew.sh git coreutils llvm@13 autoconf automake
export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$HOME/.brew/opt/llvm@13/bin:$PATH"
export CC="$HOME/.brew/opt/llvm@13/bin/clang"
export CXX="$HOME/.brew/opt/llvm@13/bin/clang++"
export LD=ld
export AR="$HOME/.brew/opt/llvm@13/bin/llvm-ar"
export RANLIB="$HOME/.brew/opt/llvm@13/bin/llvm-ranlib"
bash .github/scripts/build.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: na
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
S3_HOST: ${{ env.S3_HOST }}
HOMEBREW_CHANGE_ARCH_TO_ARM: 1
- if: matrix.ARCH == '64' && runner.os == 'macOS'
name: Run build (windows/mac)
run: |
bash .github/scripts/brew.sh coreutils
export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$PATH"
bash .github/scripts/build.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: na
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
S3_HOST: ${{ env.S3_HOST }}
HOMEBREW_CHANGE_ARCH_TO_ARM: 1
- if: runner.os == 'Windows'
name: Run build (windows/mac)
run: |
bash .github/scripts/brew.sh git coreutils autoconf automake
bash .github/scripts/build.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: na
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
S3_HOST: ${{ env.S3_HOST }}
HOMEBREW_CHANGE_ARCH_TO_ARM: 1
- if: always()
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
./out/*
build-freebsd:
name: Build binary (FreeBSD)
runs-on: [self-hosted, FreeBSD, X64]
env:
CABAL_VER: 3.10.2.0
MACOSX_DEPLOYMENT_TARGET: 10.13
JSON_VERSION: "0.0.8"
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
S3_HOST: ${{ secrets.S3_HOST }}
ARTIFACT: "x86_64-portbld-freebsd-ghcup"
GHC_VER: 9.4.8
ARCH: 64
DISTRO: na
RUNNER_OS: FreeBSD
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run build
run: |
sed -i.bak -e 's/quarterly/latest/' /etc/pkg/FreeBSD.conf
pkg install -y ghc hs-cabal-install git bash misc/compat10x misc/compat11x misc/compat12x gmake llvm14 libiconv
tzsetup Etc/GMT
adjkerntz -a
bash .github/scripts/build.sh
- if: always()
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
./out/*
test-linux:
name: Test linux
needs: "build-linux"
runs-on: ${{ matrix.os }}
env:
CABAL_VER: 3.10.2.0
JSON_VERSION: "0.0.8"
strategy:
matrix:
include:
- os: ubuntu-latest
ARTIFACT: "i386-linux-ghcup"
GHC_VER: 8.10.7
ARCH: 32
DISTRO: Alpine
- os: ubuntu-latest
ARTIFACT: "x86_64-linux-ghcup"
GHC_VER: 9.4.8
ARCH: 64
DISTRO: Alpine
- os: ubuntu-latest
ARTIFACT: "x86_64-linux-ghcup"
GHC_VER: 9.4.8
ARCH: 64
DISTRO: Ubuntu
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/download-artifact@v3
with:
name: artifacts
path: ./out
- if: matrix.ARCH == '32' && matrix.DISTRO == 'Alpine'
name: Run test (32 bit linux Alpine)
uses: docker://hasufell/i386-alpine-haskell:3.12
with:
args: sh .github/scripts/test.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: ${{ matrix.DISTRO }}
- if: matrix.ARCH == '64' && matrix.DISTRO == 'Alpine'
name: Run test (64 bit linux Alpine)
uses: docker://hasufell/alpine-haskell:3.12
with:
args: sh .github/scripts/test.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: ${{ matrix.DISTRO }}
- if: matrix.DISTRO != 'Alpine'
name: Run test (64 bit linux)
run: |
sudo apt-get install -y libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl gzip
sh .github/scripts/test.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: ${{ matrix.DISTRO }}
- if: failure()
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: testfiles
path: |
./test/ghcup-test/golden/unix/GHCupInfo*json
test-arm:
name: Test ARM
needs: "build-arm"
runs-on: ${{ matrix.os }}
env:
CABAL_VER: 3.6.2.0
JSON_VERSION: "0.0.8"
strategy:
matrix:
include:
- os: [self-hosted, Linux, ARM64, maerwald]
ARTIFACT: "armv7-linux-ghcup"
GHC_VER: 9.2.8
ARCH: ARM
DISTRO: Ubuntu
- os: [self-hosted, Linux, ARM64, maerwald]
ARTIFACT: "aarch64-linux-ghcup"
GHC_VER: 9.4.8
ARCH: ARM64
DISTRO: Ubuntu
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/download-artifact@v3
with:
name: artifacts
path: ./out
- if: matrix.ARCH == 'ARM'
uses: docker://hasufell/arm32v7-debian-haskell:10
name: Run test (armv7 linux)
with:
args: sh .github/scripts/test.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: Ubuntu
LD: ld.gold
- if: matrix.ARCH == 'ARM64'
uses: docker://hasufell/arm64v8-debian-haskell:10
name: Run test (aarch64 linux)
with:
args: sh .github/scripts/test.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: Ubuntu
- if: failure()
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: testfiles
path: |
./test/ghcup-test/golden/unix/GHCupInfo*json
test-macwin:
name: Test Mac/Win
needs: "build-macwin"
runs-on: ${{ matrix.os }}
env:
CABAL_VER: 3.10.2.0
MACOSX_DEPLOYMENT_TARGET: 10.13
JSON_VERSION: "0.0.8"
strategy:
matrix:
include:
- os: [self-hosted, macOS, ARM64]
ARTIFACT: "aarch64-apple-darwin-ghcup"
GHC_VER: 9.4.8
ARCH: ARM64
DISTRO: na
- os: macOS-11
ARTIFACT: "x86_64-apple-darwin-ghcup"
GHC_VER: 9.4.8
ARCH: 64
DISTRO: na
- os: windows-latest
ARTIFACT: "x86_64-mingw64-ghcup"
GHC_VER: 9.4.8
ARCH: 64
DISTRO: na
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/download-artifact@v3
with:
name: artifacts
path: ./out
- if: runner.os == 'macOS'
name: Run test
run: |
bash .github/scripts/brew.sh coreutils
export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$PATH"
bash .github/scripts/test.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: ${{ matrix.DISTRO }}
HOMEBREW_CHANGE_ARCH_TO_ARM: 1
- if: runner.os != 'macOS'
name: Run test
run: bash .github/scripts/test.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: ${{ matrix.DISTRO }}
HOMEBREW_CHANGE_ARCH_TO_ARM: 1
- if: failure() && runner.os == 'Windows'
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: testfiles
path: |
./test/ghcup-test/golden/windows/GHCupInfo*json
- if: failure() && runner.os != 'Windows'
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: testfiles
path: |
./test/ghcup-test/golden/unix/GHCupInfo*json
test-freebsd:
name: Test FreeBSD
needs: "build-freebsd"
runs-on: [self-hosted, FreeBSD, X64]
env:
CABAL_VER: 3.10.2.0
MACOSX_DEPLOYMENT_TARGET: 10.13
JSON_VERSION: "0.0.8"
ARTIFACT: "x86_64-portbld-freebsd-ghcup"
GHC_VER: 9.4.8
ARCH: 64
DISTRO: na
RUNNER_OS: FreeBSD
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/download-artifact@v3
with:
name: artifacts
path: ./out
- name: Run test
run: |
bash .github/scripts/test.sh
- if: failure()
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: testfiles
path: |
./test/ghcup-test/golden/unix/GHCupInfo*json
hls:
name: hls
needs: build-linux
runs-on: ubuntu-latest
env:
GHC_VERSION: "8.10.7"
HLS_TARGET_VERSION: "1.8.0.0"
CABAL_VERSION: "3.8.1.0"
JSON_VERSION: "0.0.8"
ARTIFACT: "x86_64-linux-ghcup"
DISTRO: Ubuntu
ARCH: 64
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
S3_HOST: ${{ secrets.S3_HOST }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/download-artifact@v3
with:
name: artifacts
path: ./out
- name: Run hls build
run: |
sudo apt-get install -y libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl gzip
sh .github/scripts/hls.sh
release:
name: release
needs: ["test-linux", "test-arm", "test-macwin", "test-freebsd", "hls"]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: artifacts
path: ./out
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
./out/*

28
.github/workflows/shellcheck.yaml vendored Normal file
View File

@ -0,0 +1,28 @@
name: Shellcheck
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master
jobs:
shellcheck:
name: shellcheck
runs-on: ubuntu-latest
env:
JSON_VERSION: "0.0.7"
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Run shellcheck
uses: docker://koalaman/shellcheck-alpine
with:
args: shellcheck scripts/bootstrap/bootstrap-haskell

29
.github/workflows/shimgen.yaml vendored Normal file
View File

@ -0,0 +1,29 @@
name: Shimgen CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build-shimgen:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
steps:
- uses: actions/checkout@v2
- uses: ilammy/msvc-dev-cmd@v1
- name: compile
run: cl /O1 scoop-better-shimexe/shim.c
- uses: actions/upload-artifact@v2
with:
name: shim.exe
path: shim.exe

35
.github/workflows/stack.yaml vendored Normal file
View File

@ -0,0 +1,35 @@
name: Test stack.yaml
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master
schedule:
- cron: '0 2 * * *'
jobs:
build:
name: Build binary
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macOS-latest, macOS-11, windows-latest, ubuntu-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run build
run: |
env
ghcup --version
ghcup run -i --stack latest -- stack build
shell: bash

4
.gitignore vendored
View File

@ -4,6 +4,7 @@ codex.tags
dist-newstyle/ dist-newstyle/
cabal.project.local cabal.project.local
.stack-work/ .stack-work/
.hiefiles/
bin/ bin/
/*.prof /*.prof
/*.ps /*.ps
@ -12,3 +13,6 @@ tags
TAGS TAGS
/tmp/ /tmp/
.entangled .entangled
release/
releases/
site/

View File

@ -1,198 +0,0 @@
variables:
GIT_SSL_NO_VERIFY: "1"
# Commit of ghc/ci-images repository from which to pull Docker images
DOCKER_REV: 1ac7f435c9312f10422a82d304194778378e2a1a
############################################################
# CI Step
############################################################
.debian:
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
tags:
- x86_64-linux
variables:
OS: "LINUX"
.alpine:64bit:
image: "alpine:edge"
tags:
- x86_64-linux
variables:
OS: "LINUX"
BIT: "64"
.alpine:32bit:
image: "i386/alpine:edge"
tags:
- x86_64-linux
variables:
OS: "LINUX"
BIT: "32"
.darwin:
tags:
- x86_64-darwin
variables:
OS: "DARWIN"
.freebsd:
tags:
- x86_64-freebsd
variables:
OS: "FREEBSD"
.root_cleanup:
after_script:
- BUILD_DIR=$CI_PROJECT_DIR
- echo "Cleaning $BUILD_DIR"
- cd $HOME
- test -n "$BUILD_DIR"
- shopt -s extglob
- rm -Rf "$BUILD_DIR"/!(out)
- exit 0
.test_ghcup_version:
script:
- ./.gitlab/script/ghcup_version.sh
variables:
JSON_VERSION: "0.0.2"
.test_ghcup_version:linux:
extends:
- .test_ghcup_version
- .debian
before_script:
- ./.gitlab/before_script/linux/install_deps.sh
.test_ghcup_version:darwin:
extends:
- .test_ghcup_version
- .darwin
- .root_cleanup
before_script:
- ./.gitlab/before_script/darwin/install_deps.sh
.test_ghcup_version:freebsd:
extends:
- .test_ghcup_version
- .freebsd
- .root_cleanup
before_script:
- ./.gitlab/before_script/freebsd/install_deps.sh
.release_ghcup:
script:
- ./.gitlab/script/ghcup_release.sh
artifacts:
expire_in: 2 week
paths:
- out
only:
- tags
######## linux test ########
test:linux:recommended:
extends: .test_ghcup_version:linux
variables:
GHC_VERSION: "8.8.3"
CABAL_VERSION: "3.2.0.0"
test:linux:latest:
extends: .test_ghcup_version:linux
variables:
GHC_VERSION: "8.10.1"
CABAL_VERSION: "3.2.0.0"
allow_failure: true
######## darwin test ########
test:mac:recommended:
extends: .test_ghcup_version:darwin
variables:
GHC_VERSION: "8.8.3"
CABAL_VERSION: "3.2.0.0"
test:mac:latest:
extends: .test_ghcup_version:darwin
variables:
GHC_VERSION: "8.10.1"
CABAL_VERSION: "3.2.0.0"
allow_failure: true
######## freebsd test ########
test:freebsd:recommended:
extends: .test_ghcup_version:freebsd
variables:
GHC_VERSION: "8.8.3"
CABAL_VERSION: "3.2.0.0"
test:freebsd:latest:
extends: .test_ghcup_version:freebsd
variables:
GHC_VERSION: "8.10.1"
CABAL_VERSION: "3.2.0.0"
allow_failure: true
######## linux release ########
release:linux:64bit:
extends:
- .alpine:64bit
- .release_ghcup
before_script:
- ./.gitlab/before_script/linux/alpine/install_deps.sh
variables:
ARTIFACT: "x86_64-linux-ghcup"
GHC_VERSION: "8.8.3"
CABAL_VERSION: "3.2.0.0"
release:linux:32bit:
extends:
- .alpine:32bit
- .release_ghcup
before_script:
- ./.gitlab/before_script/linux/alpine/install_deps.sh
variables:
ARTIFACT: "i386-linux-ghcup"
GHC_VERSION: "8.8.3"
CABAL_VERSION: "3.2.0.0"
######## darwin release ########
release:darwin:
extends:
- .darwin
- .release_ghcup
- .root_cleanup
before_script:
- ./.gitlab/before_script/darwin/install_deps.sh
variables:
ARTIFACT: "x86_64-apple-darwin-ghcup"
GHC_VERSION: "8.8.3"
CABAL_VERSION: "3.2.0.0"
MACOSX_DEPLOYMENT_TARGET: "10.7"
######## freebsd release ########
release:freebsd:
extends:
- .freebsd
- .release_ghcup
- .root_cleanup
before_script:
- ./.gitlab/before_script/freebsd/install_deps.sh
variables:
ARTIFACT: "x86_64-portbld-freebsd-ghcup"
GHC_VERSION: "8.8.3"
CABAL_VERSION: "3.2.0.0"

View File

@ -1,16 +0,0 @@
#!/bin/sh
set -eux
. "$( cd "$(dirname "$0")" ; pwd -P )/../../ghcup_env"
mkdir -p "${TMPDIR}"
curl -sSfL https://downloads.haskell.org/~ghcup/x86_64-apple-darwin-ghcup > ./ghcup-bin
chmod +x ghcup-bin
./ghcup-bin install ${GHC_VERSION}
./ghcup-bin set ${GHC_VERSION}
./ghcup-bin install-cabal ${CABAL_VERSION}
exit 0

View File

@ -1,18 +0,0 @@
#!/bin/sh
set -eux
# pkg install --force --yes --no-repo-update curl gcc gmp gmake ncurses perl5 libffi libiconv
. "$( cd "$(dirname "$0")" ; pwd -P )/../../ghcup_env"
mkdir -p "${TMPDIR}"
curl -sSfL https://downloads.haskell.org/~ghcup/x86_64-portbld-freebsd-ghcup > ./ghcup-bin
chmod +x ghcup-bin
./ghcup-bin install ${GHC_VERSION}
./ghcup-bin install-cabal ${CABAL_VERSION}
./ghcup-bin set ${GHC_VERSION}
exit 0

View File

@ -1,53 +0,0 @@
#!/bin/sh
set -eux
. "$( cd "$(dirname "$0")" ; pwd -P )/../../../ghcup_env"
mkdir -p "${TMPDIR}"
apk add --no-cache \
curl \
gcc \
g++ \
gmp-dev \
ncurses-dev \
libffi-dev \
make \
xz \
tar \
perl
ln -sf libncurses.so /usr/lib/libtinfo.so
ln -sf libncursesw.so.6 /usr/lib/libtinfow.so.6
ln -sf libtinfow.so.6 /usr/lib/libtinfow.so
if [ "${BIT}" = "32" ] ; then
curl -sSfL https://downloads.haskell.org/ghcup/i386-linux-ghcup > ./ghcup-bin
else
curl -sSfL https://downloads.haskell.org/ghcup/x86_64-linux-ghcup > ./ghcup-bin
fi
chmod +x ghcup-bin
./ghcup-bin install ${GHC_VERSION}
./ghcup-bin install-cabal ${CABAL_VERSION}
# utils
apk add --no-cache \
bash \
git
## Package specific
apk add --no-cache \
zlib \
zlib-dev \
zlib-static \
gmp \
gmp-dev \
openssl-dev \
openssl-libs-static \
xz \
xz-dev \
ncurses-static
ln -sf libncursesw.a /usr/lib/libtinfow.a

View File

@ -1,18 +0,0 @@
#!/bin/sh
set -eux
. "$( cd "$(dirname "$0")" ; pwd -P )/../../ghcup_env"
mkdir -p "${TMPDIR}"
sudo apt-get update -y
sudo apt-get install -y libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev git wget
curl -sSfL https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup > ./ghcup-bin
chmod +x ghcup-bin
./ghcup-bin install ${GHC_VERSION}
./ghcup-bin set ${GHC_VERSION}
./ghcup-bin install-cabal ${CABAL_VERSION}

View File

@ -1,3 +0,0 @@
export GHCUP_INSTALL_BASE_PREFIX="$CI_PROJECT_DIR"
export PATH="$CI_PROJECT_DIR/.ghcup/bin:$CI_PROJECT_DIR/.local/bin:$PATH"
export TMPDIR="$CI_PROJECT_DIR/tmp"

View File

@ -1,39 +0,0 @@
#!/bin/sh
set -eux
. "$( cd "$(dirname "$0")" ; pwd -P )/../ghcup_env"
mkdir -p "$CI_PROJECT_DIR"/.local/bin
ecabal() {
cabal --store-dir="$(pwd)"/.store "$@"
}
git describe
# build
ecabal update
if [ "${OS}" = "LINUX" ] ; then
if [ "${BIT}" = "32" ] ; then
ecabal build -w ghc-${GHC_VERSION} --ghc-options='-split-sections -optl-static' -ftui -ftar
else
ecabal build -w ghc-${GHC_VERSION} --ghc-options='-split-sections -optl-static' -ftui -finternal-downloader
fi
elif [ "${OS}" = "FREEBSD" ] ; then
ecabal build -w ghc-${GHC_VERSION} --ghc-options='-split-sections' --constraint="zlib static" -ftui
else
ecabal build -w ghc-${GHC_VERSION} --constraint="zlib static" --constraint="lzma static" -ftui
fi
mkdir out
cp "$(ecabal new-exec -w ghc-${GHC_VERSION} --verbose=0 --offline sh -- -c 'command -v ghcup')" .
ver=$(./ghcup --numeric-version)
if [ "${OS}" = "DARWIN" ] ; then
strip ./ghcup
else
strip -s ./ghcup
fi
cp ghcup out/${ARTIFACT}-${ver}

View File

@ -1,92 +0,0 @@
#!/bin/sh
set -eux
. "$( cd "$(dirname "$0")" ; pwd -P )/../ghcup_env"
mkdir -p "$CI_PROJECT_DIR"/.local/bin
ecabal() {
cabal --store-dir="$(pwd)"/.store "$@"
}
eghcup() {
ghcup -v -c -s file://$(pwd)/ghcup-${JSON_VERSION}.json "$@"
}
git describe --always
### build
ecabal update
if [ "${OS}" = "DARWIN" ] ; then
ecabal build -w ghc-${GHC_VERSION} -ftui
else
ecabal build -w ghc-${GHC_VERSION} -finternal-downloader -ftui
fi
cp "$(ecabal new-exec --enable-tests --verbose=0 --offline sh -- -c 'command -v ghcup')" .
cp "$(ecabal new-exec --enable-tests --verbose=0 --offline sh -- -c 'command -v ghcup-gen')" .
cp ./ghcup "$CI_PROJECT_DIR"/.local/bin/ghcup
cp ./ghcup-gen "$CI_PROJECT_DIR"/.local/bin/ghcup-gen
### cleanup
rm -rf "${GHCUP_INSTALL_BASE_PREFIX}"/.ghcup
### manual cli based testing
ghcup-gen check -f ghcup-${JSON_VERSION}.json
eghcup --numeric-version
# TODO: rm once we have tarballs
if [ "${OS}" = "FREEBSD" ] ; then
GHC_VERSION=8.6.3
CABAL_VERSION=2.4.1.0
fi
eghcup install ${GHC_VERSION}
eghcup set ${GHC_VERSION}
eghcup install-cabal ${CABAL_VERSION}
cabal --version
eghcup debug-info
eghcup list
eghcup list -t ghc
eghcup list -t cabal
ghc_ver=$(ghc --numeric-version)
ghc --version
ghci --version
ghc-$(ghc --numeric-version) --version
ghci-$(ghc --numeric-version) --version
# test installing new ghc doesn't mess with currently set GHC
# https://gitlab.haskell.org/haskell/ghcup-hs/issues/7
if [ "${OS}" = "LINUX" ] ; then
eghcup --downloader=wget install 8.4.4
else # test wget a bit
eghcup install 8.4.4
fi
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
eghcup set 8.4.4
eghcup set 8.4.4
[ "$(ghc --numeric-version)" = "8.4.4" ]
eghcup set ${GHC_VERSION}
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
eghcup rm 8.4.4
[ "$(ghc --numeric-version)" = "${ghc_ver}" ]
eghcup rm $(ghc --numeric-version)
eghcup upgrade
eghcup upgrade -f

4
.gitmodules vendored Normal file
View File

@ -0,0 +1,4 @@
[submodule "data/metadata"]
path = data/metadata
url = https://github.com/haskell/ghcup-metadata.git
branch = develop

84
.hlint.yaml Normal file
View File

@ -0,0 +1,84 @@
# HLint configuration file
# https://github.com/ndmitchell/hlint
##########################
# This file contains a template configuration file, which is typically
# placed as .hlint.yaml in the root of your project
# Warnings currently triggered by your code
- ignore: {name: "Redundant bang pattern"}
- ignore: {name: "Use camelCase"}
- ignore: {name: "Use if"}
- ignore: {name: "Use newtype instead of data"}
- ignore: {name: "Use <$>"}
- ignore: {name: "Use mapMaybe"}
- ignore: {name: "Use const"}
- ignore: {name: "Use list comprehension"}
- ignore: {name: "Redundant multi-way if"}
- ignore: {name: "Redundant lambda"}
- ignore: {name: "Avoid lambda"}
- ignore: {name: "Use uncurry"}
- ignore: {name: "Use replicateM"}
- ignore: {name: "Use unless"}
- ignore: {name: "Redundant irrefutable pattern"}
# Specify additional command line arguments
#
# - arguments: [--color, --cpp-simple, -XQuasiQuotes]
# Control which extensions/flags/modules/functions can be used
#
# - extensions:
# - default: false # all extension are banned by default
# - name: [PatternGuards, ViewPatterns] # only these listed extensions can be used
# - {name: CPP, within: CrossPlatform} # CPP can only be used in a given module
#
# - flags:
# - {name: -w, within: []} # -w is allowed nowhere
#
# - modules:
# - {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set'
# - {name: Control.Arrow, within: []} # Certain modules are banned entirely
#
# - functions:
# - {name: unsafePerformIO, within: []} # unsafePerformIO can only appear in no modules
# Add custom hints for this project
#
# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar"
# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x}
# The hints are named by the string they display in warning messages.
# For example, if you see a warning starting like
#
# Main.hs:116:51: Warning: Redundant ==
#
# You can refer to that hint with `{name: Redundant ==}` (see below).
# Turn on hints that are off by default
#
# Ban "module X(module X) where", to require a real export list
# - warn: {name: Use explicit module export list}
#
# Replace a $ b $ c with a . b $ c
# - group: {name: dollar, enabled: true}
#
# Generalise map to fmap, ++ to <>
# - group: {name: generalise, enabled: true}
# Ignore some builtin hints
# - ignore: {name: Use let}
# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules
# Define some custom infix operators
# - fixity: infixr 3 ~^#^~
# To generate a suitable file for HLint do:
# $ hlint --default > .hlint.yaml

View File

@ -1,25 +0,0 @@
jobs:
include:
- os: osx
osx_image: xcode10.1
language: generic
env: ARTIFACT=x86_64-apple-darwin-10.13-ghcup
- os: osx
osx_image: xcode11.3
language: generic
env: ARTIFACT=x86_64-apple-darwin-10.14-ghcup
script: ".travis/build.sh"
deploy:
provider: releases
api_key:
secure: GQESg4TcYf3PQJRRaZV/kWS0hsF+OFnH2+EcwpgnIcfx4+aogMyprdh745KtBXe1FlFN1luKHksFjqceqhcg/xcNyeCJiSnLWMn4D/i4WUperEHseRBi5yZZCB1AvOjIlHrE4DS3a8pyEm1GV3G7CKY5Fu8jBjof2SnyENfd7fofhjtNHWmeFS+jBn8HRDf1YaSRYxzTw6uHLrPLsybfgQZVl7babMu/38Ghin0f5pz5OlNokzDxaubIYQHOZ7st7YndHJtBWWql/KualBWbMILy88dUVQBnbqQLP2P8d1ME8ILUjJVqz33HiRU0JzlEJyWfbvEjcJ6iD8M6n4nXTaxfu3i2UhhGsQ6SSBNKssMP4tji8nkNpMqG59wLQ/zhcetEm71fKkgJNrIMNllkqlWSo5K74IqqP9kiLg/qm8ipOJjui0gPk8tZXKcV+ztX1d1OVCapoLfiDM5l/0LLQXaTOXOV1x3e5LLQ/w2doNiH3eh5CV4II9dRu7owpaiiMBHMssmT0pH99jEeF6giHLKtt3y7l2GWoRLPdhsZZ54gxsaBxZt9GuypmkbNcr97CEnAVaWij5v0CF3w4rAWqy/tAxQpIDJOIOQBgmwG5WrBAKyKrFvEpBL5a8BPcRWJDvqKC83QeWpvPrEVdgJevC6ZN1MKzrb2SiPOwC2Kerc=
file: $ARTIFACT
on:
repo: haskell/ghcup-hs
tags: true
skip_cleanup: true
draft: true

View File

@ -1,24 +0,0 @@
#!/bin/sh
set -ex
## install ghc via old ghcup
mkdir -p ~/.ghcup/bin
curl https://gitlab.haskell.org/haskell/ghcup/raw/master/ghcup > ~/.ghcup/bin/ghcup
chmod +x ~/.ghcup/bin/ghcup
export PATH="$HOME/.ghcup/bin:$PATH"
ghcup install 8.8.3
ghcup install-cabal 3.2.0.0
ghcup set 8.8.3
## install ghcup
cabal update
cabal build --constraint="zlib static" --constraint="lzma static" -ftui
cp "$(cabal new-exec --verbose=0 --offline sh -- -c 'command -v ghcup')" .
strip ./ghcup
cp ghcup "./${ARTIFACT}"

View File

@ -1 +0,0 @@
*.chs linguist-language=Haskell

View File

@ -1,14 +0,0 @@
*.swp
.ghc.environment*
tags
*.prof
*.hp
*.eventlog
dist-newstyle
*.tar
*.chi
*.chs.h
.hspec-failures
.stack-work
libarchive-*.tar.*
libarchive-*/

View File

@ -1,13 +0,0 @@
---
- functions:
- {name: undefined, within: []}
- {name: traceShowId, within: []}
- {name: print, within: []}
- {name: traceShow, within: []}
- {name: nullPtr, within: [Codec.Archive.Unpack, Codec.Archive.Foreign.Archive]}
- error: {lhs: "if p then x else pure ()", rhs: "when p x"}
- ignore: {name: Use lambda-case}
- fixity: infixr 8 .*
- fixity: infixr 8 .**

View File

@ -1,4 +0,0 @@
--fail-fast
--failure-report .hspec-failures
--rerun
--rerun-all-on-success

View File

@ -1,24 +0,0 @@
---
steps:
- simple_align:
cases: true
top_level_patterns: true
records: true
- imports:
align: global
list_align: after_alias
pad_module_names: true
long_list_align: inline
empty_list_align: inherit
list_padding: 4
separate_lists: true
space_surround: false
- language_pragmas:
style: vertical
align: true
remove_redundant: false
- trailing_whitespace: {}
columns: 160
newline: native
language_extensions: [FlexibleContexts]

View File

@ -1,152 +0,0 @@
# libarchive
## 2.2.5.0
* Speed improvements in places
* Add `throwArchiveM` convenience function
## 2.2.4.0
* Add convenience functions for `.xar` archives
## 2.2.3.0
* Add convenience functions for working with `.cpio` archives
## 2.2.2.0
* Add `Ord` instance to `Entry`, `Symlink`, `EntryContent`, `Ownership`
* Make `content` field of `Entry` lazy
* Add `Eq` instance to `ArchiveEncryption`
## 2.2.1.0
* Add `Exception` instance for `ArchiveResult`
## 2.2.0.2
* Use `bracket` where it doesn't crash GHC
## 2.2.0.1
* Use `bracket` in a few places where it doesn't crash GHC
## 2.2.0.0
* Haskell `Entry` type now includes `Symlink` field
## 2.1.3.2
* Fix segfault in strict function
## 2.1.3.0
* `archiveVersionString` &c. are now pure
## 2.1.2.1
* Fixed bug that would cause segfaults on lazy bytestrings with large chunks
## 2.1.2.0
* More complete API
## 2.1.1.0
* Remove weeds, export things that were missing from past releases
## 2.1.0.1
* `packEntries` and friends now detect hardlinks
* Add `Cabal` to `custom-setup` depends to ensure builds work with stack
## 2.1.0.0
* Remove `archiveEntryAclNext` since it doesn't exist in the static linked
library. This means `libarchive` can be used in profiling builds.
## 2.0.0.2
* Export `FilePtr` type constructor
* Clean up spurious code
## 2.0.0.1
* Polish documentation
## 2.0.0.0
* Fix typo in documentation
* Improve docs
* `archiveReadOpenMemory` now accepts an argument of type `Ptr a` rather
than `Ptr CChar`
* `unpackToDirLazy`, `unpackArchive`, and `archiveUnpackToDir` now occur in the `ArchiveM` monad
* `readArchiveBSL` and `readArchiveBS` now return `Either ArchiveResult [Entry]` rather than
failing silently
* `readArchiveFile` now returns an `ArchiveM [Entry]` rather than returning an
`IO [Entry]`
* `enriesToFile`, `entriesToFile7Zip`, and `entriesToFileZip` now occur in the
`ArchiveM` monad
* Make various parts of an `Entry` optional
* Add `packToFile` functions and `packFiles` functions
* Remove `ArchiveError` newtype, replace it with `ArchiveResult`
* Fix bug in `archiveEntryMTimeIsSet`
* Add `archiveEntryACLEntryInherited`, `archiveEntryACLStyleSolaris`,
`archiveEntryACLStyleSeparatorComma`, `archiveEntryACLStyleCompact`
* Add `archiveReadDiskNoAcl`, `archiveReadDiskNoFFlags`
* Depend on `libarchive` >= 3.4.0
* Remove `Raw` modules, use c2hs throughout.
* Fix potential bug with lazy bytestrings of nonstandard size
## 1.0.5.1
* Add `cross` flag
## 1.0.5.0
* Add facilities for lazy packing, e.g. `entriesToBSL`
* Minor documentation fixes
## 1.0.4.0
* Add `noOpenCallback`
* Add various facilities for lazy/streaming archives, viz. `unpackToDirLazy`,
`bslToArchive`, and `readArchiveBSL`.
* Remove `unsafe` stuff everywhere
## 1.0.3.0
* Fix types for `archive_set_read_callback` and
`archive_read_set_seek_callback`
## 1.0.2.0
* Add `Eq` instance for `ArchiveFormat`
## 1.0.1.0
* Remove functions from libarchive 3.3.3
## 1.0.0.0
* Get rid of `cbits`
* Add low-level FFI bindings
* Add high-level functions for unpacking archives
## 0.2.1.2
* Stream from a file when using `unpackArchive`
## 0.2.1.1
* Preserve modification times by default
## 0.2.1.0
* Enable autodetection of archive format/compression
* Slightly improved docs
* Rename `unpackTarball` to `unpackArchive`
## 0.2.0.0
* Fix bug in paths

View File

@ -1,11 +0,0 @@
Copyright Vanessa McHale (c) 2018-2020
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,42 +0,0 @@
.PHONY: clean
MAKEFLAGS += --warn-undefined-variables --no-builtin-rules -j
.DELETE_ON_ERROR:
setup: test/data/ghc-8.8.1-src.tar test/data/alsa-lib-1.1.9.tar test/data/llvm-9.0.0.src.tar test/data/ATS2-Postiats-0.3.13.tar test/data/libarchive-1.0.5.1.tar
clean:
rm -rf dist-newstyle dist test/data/*.tar* test/data/*.tgz *.hp *.prof *.chi *.chs.h stack.yaml.lock .hspec-failures .stack-work tags *.svg
test/data:
mkdir -p $@
test/data/ghc-8.8.1-src.tar: test/data/ghc-8.8.1-src.tar.xz
xz -d -f $^
test/data/alsa-lib-1.1.9.tar: test/data/alsa-lib-1.1.9.tar.bz2
bzip2 -d -f $^
test/data/llvm-9.0.0.src.tar: test/data/llvm-9.0.0.src.tar.xz
xz -d -f $^
test/data/ATS2-Postiats-0.3.13.tar: test/data/ATS2-Postiats-0.3.13.tgz
gunzip -f $^
test/data/libarchive-1.0.5.1.tar: test/data/libarchive-1.0.5.1.tar.gz
gunzip -f $^
test/data/ghc-8.8.1-src.tar.xz: test/data
wget https://downloads.haskell.org/~ghc/8.8.1/ghc-8.8.1-src.tar.xz -O $@
test/data/alsa-lib-1.1.9.tar.bz2: test/data
wget https://www.alsa-project.org/files/pub/lib/alsa-lib-1.1.9.tar.bz2 -O $@
test/data/llvm-9.0.0.src.tar.xz: test/data
wget http://releases.llvm.org/9.0.0/llvm-9.0.0.src.tar.xz -O $@
test/data/ATS2-Postiats-0.3.13.tgz: test/data
wget http://ats-lang.sourceforge.net/IMPLEMENT/Postiats/ATS2-Postiats-0.3.13.tgz -O $@
test/data/libarchive-1.0.5.1.tar.gz: test/data
wget http://hackage.haskell.org/package/libarchive-1.0.5.1/libarchive-1.0.5.1.tar.gz -O $@

View File

@ -1,28 +0,0 @@
# libarchive
[![Hackage CI](https://matrix.hackage.haskell.org/api/v2/packages/libarchive/badge)](https://matrix.hackage.haskell.org/package/libarchive)
[![Hackage](https://img.shields.io/hackage/v/libarchive.svg)](http://hackage.haskell.org/package/libarchive)
[![Dependencies of latest version on Hackage](https://img.shields.io/hackage-deps/v/libarchive.svg)](https://hackage.haskell.org/package/libarchive)
This contains Haskell bindings to
[libarchive](http://libarchive.org/). It was created as an alternative to
[tar](http://hackage.haskell.org/package/tar) and
[tar-conduit](http://hackage.haskell.org/package/tar-conduit), but it supports
more archive formats.
It has a high-level Haskell API for creating and unpacking archives in addition
to the C API. Like the `tar` package, it can stream from lazy `ByteString`s.
## Hacking
To run the test suite, first run
```
make
```
so that you have appropriate test data downloaded.
## Performance
`libarchive` is faster than `tar` or `tar-conduit` when unpacking archives.

View File

@ -1,6 +0,0 @@
module Main (main) where
import Distribution.C2Hs (defaultMainC2Hs)
main :: IO ()
main = defaultMainC2Hs

View File

@ -1,26 +0,0 @@
# Code Maintenance
- [ ] Test suite
- [ ] Figure out how to test for memory leaks
- [ ] Space leak via Neil Mitchell
- [ ] Valgrind?
- [x] Test edge cases (non-standard chunk sizes)
- [ ] Test multithreaded (start unpacking in one thread)
- [ ] CI
- [x] Nix integration (`cabal2nix`)
- [x] Dependent on upstream
# Performance
- [ ] Fix actual laziness (?) -> appears downstream in sak in particular
conditions
# Bugs
- [ ] segfault (libarchive?) when I mess with .tar files
- [ ] librachive haskell broken? my .7z and .xar outputs aren't great
- [ ] Fix space leak in converting stuff (bad; also from verify-archive)
# Features
- [ ] xar? 7zip?
# Documentation
- [ ] Add example in haddocks
- [ ] Document ability to use via `archive-sig`/`archive-libarchive`.
# Upstream
- [ ] PVP for signatures?
- [ ] sig: specify compatible stuff? versions not clear...
- [ ] GHC: `bracket` branch? What is going on??

View File

@ -1,13 +0,0 @@
#!/usr/bin/env bash
set -e
case "$(uname)" in
"Darwin") svg_open="open";;
*) svg_open="firefox";;
esac
cabal build mem --enable-profiling -w ghc-8.10.1
"$(fd '^mem$' -t x -I)" +RTS -h
hp2pretty mem.hp
$svg_open mem.svg

View File

@ -1,55 +0,0 @@
module Main (main) where
import Codec.Archive
import Codec.Archive.Tar (Entries (..), FormatError)
import qualified Codec.Archive.Tar as Tar
import Control.Monad (void)
import Control.Monad.IO.Class (liftIO)
import Criterion.Main
import qualified Data.ByteString.Lazy as BSL
import Data.Conduit.Tar as TarConduit
import System.IO.Temp (withSystemTempDirectory)
roundtrip :: BSL.ByteString -> Either ArchiveResult BSL.ByteString
roundtrip = fmap entriesToBSL . readArchiveBSL
failTar :: Entries a -> Either a [Tar.Entry]
failTar (Next e es) = (e :) <$> failTar es
failTar Done = Right []
failTar (Fail e) = Left e
roundtripTar :: BSL.ByteString -> Either FormatError BSL.ByteString
roundtripTar = fmap Tar.write . failTar . Tar.read
unpack :: IO (Either ArchiveResult ())
unpack = withSystemTempDirectory "libarchive" $
\fp -> runArchiveM $ unpackArchive "test/data/libarchive-1.0.5.1.tar" fp
unpackHs :: IO (Either ArchiveResult ())
unpackHs = withSystemTempDirectory "libarchive" $
\fp -> runArchiveM $ unpackToDirLazy fp =<< liftIO (BSL.readFile "test/data/libarchive-1.0.5.1.tar")
extractTar :: IO ()
extractTar = withSystemTempDirectory "tar" $
\fp -> Tar.extract fp "test/data/libarchive-1.0.5.1.tar"
-- I'm not even sure why I'm benchmarking this since it doesn't work
unpackTarConduit :: IO ()
unpackTarConduit = withSystemTempDirectory "tar" $
\fp -> void $ TarConduit.extractTarballLenient "test/data/libarchive-1.0.5.1.tar" (Just fp)
main :: IO ()
main =
defaultMain [ env file $ \ f ->
bgroup "roundtrip"
[ bench "libarchive" $ nf roundtrip f
, bench "tar" $ nf roundtripTar f
]
, bgroup "unpack"
[ bench "libarchive (via bytestring)" $ nfIO unpackHs
, bench "libarchive (C API)" $ nfIO unpack
, bench "tar" $ nfIO extractTar
, bench "tarConduit" $ nfIO unpackTarConduit
]
]
where file = BSL.readFile "test/data/libarchive-1.0.5.1.tar"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,83 +0,0 @@
/*-
* Copyright (c) 2003-2010 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef ARCHIVE_ACL_PRIVATE_H_INCLUDED
#define ARCHIVE_ACL_PRIVATE_H_INCLUDED
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
#include "archive_string.h"
struct archive_acl_entry {
struct archive_acl_entry *next;
int type; /* E.g., access or default */
int tag; /* E.g., user/group/other/mask */
int permset; /* r/w/x bits */
int id; /* uid/gid for user/group */
struct archive_mstring name; /* uname/gname */
};
struct archive_acl {
mode_t mode;
struct archive_acl_entry *acl_head;
struct archive_acl_entry *acl_p;
int acl_state; /* See acl_next for details. */
wchar_t *acl_text_w;
char *acl_text;
int acl_types;
};
void archive_acl_clear(struct archive_acl *);
void archive_acl_copy(struct archive_acl *, struct archive_acl *);
int archive_acl_count(struct archive_acl *, int);
int archive_acl_types(struct archive_acl *);
int archive_acl_reset(struct archive_acl *, int);
int archive_acl_next(struct archive *, struct archive_acl *, int,
int *, int *, int *, int *, const char **);
int archive_acl_add_entry(struct archive_acl *, int, int, int, int, const char *);
int archive_acl_add_entry_w_len(struct archive_acl *,
int, int, int, int, const wchar_t *, size_t);
int archive_acl_add_entry_len(struct archive_acl *,
int, int, int, int, const char *, size_t);
wchar_t *archive_acl_to_text_w(struct archive_acl *, ssize_t *, int,
struct archive *);
char *archive_acl_to_text_l(struct archive_acl *, ssize_t *, int,
struct archive_string_conv *);
/*
* ACL text parser.
*/
int archive_acl_from_text_w(struct archive_acl *, const wchar_t * /* wtext */,
int /* type */);
int archive_acl_from_text_l(struct archive_acl *, const char * /* text */,
int /* type */, struct archive_string_conv *);
#endif /* ARCHIVE_ENTRY_PRIVATE_H_INCLUDED */

View File

@ -1,195 +0,0 @@
/*
BLAKE2 reference source code package - reference C implementations
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
your option. The terms of these licenses can be found at:
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
- OpenSSL license : https://www.openssl.org/source/license.html
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
More information about the BLAKE2 hash function can be found at
https://blake2.net.
*/
#ifndef ARCHIVE_BLAKE2_H
#define ARCHIVE_BLAKE2_H
#include <stddef.h>
#include <stdint.h>
#if defined(_MSC_VER)
#define BLAKE2_PACKED(x) __pragma(pack(push, 1)) x __pragma(pack(pop))
#else
#define BLAKE2_PACKED(x) x __attribute__((packed))
#endif
#if defined(__cplusplus)
extern "C" {
#endif
enum blake2s_constant
{
BLAKE2S_BLOCKBYTES = 64,
BLAKE2S_OUTBYTES = 32,
BLAKE2S_KEYBYTES = 32,
BLAKE2S_SALTBYTES = 8,
BLAKE2S_PERSONALBYTES = 8
};
enum blake2b_constant
{
BLAKE2B_BLOCKBYTES = 128,
BLAKE2B_OUTBYTES = 64,
BLAKE2B_KEYBYTES = 64,
BLAKE2B_SALTBYTES = 16,
BLAKE2B_PERSONALBYTES = 16
};
typedef struct blake2s_state__
{
uint32_t h[8];
uint32_t t[2];
uint32_t f[2];
uint8_t buf[BLAKE2S_BLOCKBYTES];
size_t buflen;
size_t outlen;
uint8_t last_node;
} blake2s_state;
typedef struct blake2b_state__
{
uint64_t h[8];
uint64_t t[2];
uint64_t f[2];
uint8_t buf[BLAKE2B_BLOCKBYTES];
size_t buflen;
size_t outlen;
uint8_t last_node;
} blake2b_state;
typedef struct blake2sp_state__
{
blake2s_state S[8][1];
blake2s_state R[1];
uint8_t buf[8 * BLAKE2S_BLOCKBYTES];
size_t buflen;
size_t outlen;
} blake2sp_state;
typedef struct blake2bp_state__
{
blake2b_state S[4][1];
blake2b_state R[1];
uint8_t buf[4 * BLAKE2B_BLOCKBYTES];
size_t buflen;
size_t outlen;
} blake2bp_state;
BLAKE2_PACKED(struct blake2s_param__
{
uint8_t digest_length; /* 1 */
uint8_t key_length; /* 2 */
uint8_t fanout; /* 3 */
uint8_t depth; /* 4 */
uint32_t leaf_length; /* 8 */
uint32_t node_offset; /* 12 */
uint16_t xof_length; /* 14 */
uint8_t node_depth; /* 15 */
uint8_t inner_length; /* 16 */
/* uint8_t reserved[0]; */
uint8_t salt[BLAKE2S_SALTBYTES]; /* 24 */
uint8_t personal[BLAKE2S_PERSONALBYTES]; /* 32 */
});
typedef struct blake2s_param__ blake2s_param;
BLAKE2_PACKED(struct blake2b_param__
{
uint8_t digest_length; /* 1 */
uint8_t key_length; /* 2 */
uint8_t fanout; /* 3 */
uint8_t depth; /* 4 */
uint32_t leaf_length; /* 8 */
uint32_t node_offset; /* 12 */
uint32_t xof_length; /* 16 */
uint8_t node_depth; /* 17 */
uint8_t inner_length; /* 18 */
uint8_t reserved[14]; /* 32 */
uint8_t salt[BLAKE2B_SALTBYTES]; /* 48 */
uint8_t personal[BLAKE2B_PERSONALBYTES]; /* 64 */
});
typedef struct blake2b_param__ blake2b_param;
typedef struct blake2xs_state__
{
blake2s_state S[1];
blake2s_param P[1];
} blake2xs_state;
typedef struct blake2xb_state__
{
blake2b_state S[1];
blake2b_param P[1];
} blake2xb_state;
/* Padded structs result in a compile-time error */
enum {
BLAKE2_DUMMY_1 = 1/(sizeof(blake2s_param) == BLAKE2S_OUTBYTES),
BLAKE2_DUMMY_2 = 1/(sizeof(blake2b_param) == BLAKE2B_OUTBYTES)
};
/* Streaming API */
int blake2s_init( blake2s_state *S, size_t outlen );
int blake2s_init_key( blake2s_state *S, size_t outlen, const void *key, size_t keylen );
int blake2s_init_param( blake2s_state *S, const blake2s_param *P );
int blake2s_update( blake2s_state *S, const void *in, size_t inlen );
int blake2s_final( blake2s_state *S, void *out, size_t outlen );
int blake2b_init( blake2b_state *S, size_t outlen );
int blake2b_init_key( blake2b_state *S, size_t outlen, const void *key, size_t keylen );
int blake2b_init_param( blake2b_state *S, const blake2b_param *P );
int blake2b_update( blake2b_state *S, const void *in, size_t inlen );
int blake2b_final( blake2b_state *S, void *out, size_t outlen );
int blake2sp_init( blake2sp_state *S, size_t outlen );
int blake2sp_init_key( blake2sp_state *S, size_t outlen, const void *key, size_t keylen );
int blake2sp_update( blake2sp_state *S, const void *in, size_t inlen );
int blake2sp_final( blake2sp_state *S, void *out, size_t outlen );
int blake2bp_init( blake2bp_state *S, size_t outlen );
int blake2bp_init_key( blake2bp_state *S, size_t outlen, const void *key, size_t keylen );
int blake2bp_update( blake2bp_state *S, const void *in, size_t inlen );
int blake2bp_final( blake2bp_state *S, void *out, size_t outlen );
/* Variable output length API */
int blake2xs_init( blake2xs_state *S, const size_t outlen );
int blake2xs_init_key( blake2xs_state *S, const size_t outlen, const void *key, size_t keylen );
int blake2xs_update( blake2xs_state *S, const void *in, size_t inlen );
int blake2xs_final(blake2xs_state *S, void *out, size_t outlen);
int blake2xb_init( blake2xb_state *S, const size_t outlen );
int blake2xb_init_key( blake2xb_state *S, const size_t outlen, const void *key, size_t keylen );
int blake2xb_update( blake2xb_state *S, const void *in, size_t inlen );
int blake2xb_final(blake2xb_state *S, void *out, size_t outlen);
/* Simple API */
int blake2s( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
int blake2b( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
int blake2sp( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
int blake2bp( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
int blake2xs( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
int blake2xb( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
/* This is simply an alias for blake2b */
int blake2( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen );
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -1,161 +0,0 @@
/*
BLAKE2 reference source code package - reference C implementations
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
your option. The terms of these licenses can be found at:
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
- OpenSSL license : https://www.openssl.org/source/license.html
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
More information about the BLAKE2 hash function can be found at
https://blake2.net.
*/
#ifndef ARCHIVE_BLAKE2_IMPL_H
#define ARCHIVE_BLAKE2_IMPL_H
#include <stdint.h>
#include <string.h>
#if !defined(__cplusplus) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L)
#if defined(_MSC_VER)
#define BLAKE2_INLINE __inline
#elif defined(__GNUC__)
#define BLAKE2_INLINE __inline__
#else
#define BLAKE2_INLINE
#endif
#else
#define BLAKE2_INLINE inline
#endif
static BLAKE2_INLINE uint32_t load32( const void *src )
{
#if defined(NATIVE_LITTLE_ENDIAN)
uint32_t w;
memcpy(&w, src, sizeof w);
return w;
#else
const uint8_t *p = ( const uint8_t * )src;
return (( uint32_t )( p[0] ) << 0) |
(( uint32_t )( p[1] ) << 8) |
(( uint32_t )( p[2] ) << 16) |
(( uint32_t )( p[3] ) << 24) ;
#endif
}
static BLAKE2_INLINE uint64_t load64( const void *src )
{
#if defined(NATIVE_LITTLE_ENDIAN)
uint64_t w;
memcpy(&w, src, sizeof w);
return w;
#else
const uint8_t *p = ( const uint8_t * )src;
return (( uint64_t )( p[0] ) << 0) |
(( uint64_t )( p[1] ) << 8) |
(( uint64_t )( p[2] ) << 16) |
(( uint64_t )( p[3] ) << 24) |
(( uint64_t )( p[4] ) << 32) |
(( uint64_t )( p[5] ) << 40) |
(( uint64_t )( p[6] ) << 48) |
(( uint64_t )( p[7] ) << 56) ;
#endif
}
static BLAKE2_INLINE uint16_t load16( const void *src )
{
#if defined(NATIVE_LITTLE_ENDIAN)
uint16_t w;
memcpy(&w, src, sizeof w);
return w;
#else
const uint8_t *p = ( const uint8_t * )src;
return ( uint16_t )((( uint32_t )( p[0] ) << 0) |
(( uint32_t )( p[1] ) << 8));
#endif
}
static BLAKE2_INLINE void store16( void *dst, uint16_t w )
{
#if defined(NATIVE_LITTLE_ENDIAN)
memcpy(dst, &w, sizeof w);
#else
uint8_t *p = ( uint8_t * )dst;
*p++ = ( uint8_t )w; w >>= 8;
*p++ = ( uint8_t )w;
#endif
}
static BLAKE2_INLINE void store32( void *dst, uint32_t w )
{
#if defined(NATIVE_LITTLE_ENDIAN)
memcpy(dst, &w, sizeof w);
#else
uint8_t *p = ( uint8_t * )dst;
p[0] = (uint8_t)(w >> 0);
p[1] = (uint8_t)(w >> 8);
p[2] = (uint8_t)(w >> 16);
p[3] = (uint8_t)(w >> 24);
#endif
}
static BLAKE2_INLINE void store64( void *dst, uint64_t w )
{
#if defined(NATIVE_LITTLE_ENDIAN)
memcpy(dst, &w, sizeof w);
#else
uint8_t *p = ( uint8_t * )dst;
p[0] = (uint8_t)(w >> 0);
p[1] = (uint8_t)(w >> 8);
p[2] = (uint8_t)(w >> 16);
p[3] = (uint8_t)(w >> 24);
p[4] = (uint8_t)(w >> 32);
p[5] = (uint8_t)(w >> 40);
p[6] = (uint8_t)(w >> 48);
p[7] = (uint8_t)(w >> 56);
#endif
}
static BLAKE2_INLINE uint64_t load48( const void *src )
{
const uint8_t *p = ( const uint8_t * )src;
return (( uint64_t )( p[0] ) << 0) |
(( uint64_t )( p[1] ) << 8) |
(( uint64_t )( p[2] ) << 16) |
(( uint64_t )( p[3] ) << 24) |
(( uint64_t )( p[4] ) << 32) |
(( uint64_t )( p[5] ) << 40) ;
}
static BLAKE2_INLINE void store48( void *dst, uint64_t w )
{
uint8_t *p = ( uint8_t * )dst;
p[0] = (uint8_t)(w >> 0);
p[1] = (uint8_t)(w >> 8);
p[2] = (uint8_t)(w >> 16);
p[3] = (uint8_t)(w >> 24);
p[4] = (uint8_t)(w >> 32);
p[5] = (uint8_t)(w >> 40);
}
static BLAKE2_INLINE uint32_t rotr32( const uint32_t w, const unsigned c )
{
return ( w >> c ) | ( w << ( 32 - c ) );
}
static BLAKE2_INLINE uint64_t rotr64( const uint64_t w, const unsigned c )
{
return ( w >> c ) | ( w << ( 64 - c ) );
}
/* prevents compiler optimizing out memset() */
static BLAKE2_INLINE void secure_zero_memory(void *v, size_t n)
{
static void *(*const volatile memset_v)(void *, int, size_t) = &memset;
memset_v(v, 0, n);
}
#endif

View File

@ -1,367 +0,0 @@
/*
BLAKE2 reference source code package - reference C implementations
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
your option. The terms of these licenses can be found at:
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
- OpenSSL license : https://www.openssl.org/source/license.html
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
More information about the BLAKE2 hash function can be found at
https://blake2.net.
*/
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include "archive_blake2.h"
#include "archive_blake2_impl.h"
static const uint32_t blake2s_IV[8] =
{
0x6A09E667UL, 0xBB67AE85UL, 0x3C6EF372UL, 0xA54FF53AUL,
0x510E527FUL, 0x9B05688CUL, 0x1F83D9ABUL, 0x5BE0CD19UL
};
static const uint8_t blake2s_sigma[10][16] =
{
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } ,
{ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } ,
{ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } ,
{ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } ,
{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } ,
{ 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } ,
{ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } ,
{ 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } ,
{ 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } ,
};
static void blake2s_set_lastnode( blake2s_state *S )
{
S->f[1] = (uint32_t)-1;
}
/* Some helper functions, not necessarily useful */
static int blake2s_is_lastblock( const blake2s_state *S )
{
return S->f[0] != 0;
}
static void blake2s_set_lastblock( blake2s_state *S )
{
if( S->last_node ) blake2s_set_lastnode( S );
S->f[0] = (uint32_t)-1;
}
static void blake2s_increment_counter( blake2s_state *S, const uint32_t inc )
{
S->t[0] += inc;
S->t[1] += ( S->t[0] < inc );
}
static void blake2s_init0( blake2s_state *S )
{
size_t i;
memset( S, 0, sizeof( blake2s_state ) );
for( i = 0; i < 8; ++i ) S->h[i] = blake2s_IV[i];
}
/* init2 xors IV with input parameter block */
int blake2s_init_param( blake2s_state *S, const blake2s_param *P )
{
const unsigned char *p = ( const unsigned char * )( P );
size_t i;
blake2s_init0( S );
/* IV XOR ParamBlock */
for( i = 0; i < 8; ++i )
S->h[i] ^= load32( &p[i * 4] );
S->outlen = P->digest_length;
return 0;
}
/* Sequential blake2s initialization */
int blake2s_init( blake2s_state *S, size_t outlen )
{
blake2s_param P[1];
/* Move interval verification here? */
if ( ( !outlen ) || ( outlen > BLAKE2S_OUTBYTES ) ) return -1;
P->digest_length = (uint8_t)outlen;
P->key_length = 0;
P->fanout = 1;
P->depth = 1;
store32( &P->leaf_length, 0 );
store32( &P->node_offset, 0 );
store16( &P->xof_length, 0 );
P->node_depth = 0;
P->inner_length = 0;
/* memset(P->reserved, 0, sizeof(P->reserved) ); */
memset( P->salt, 0, sizeof( P->salt ) );
memset( P->personal, 0, sizeof( P->personal ) );
return blake2s_init_param( S, P );
}
int blake2s_init_key( blake2s_state *S, size_t outlen, const void *key, size_t keylen )
{
blake2s_param P[1];
if ( ( !outlen ) || ( outlen > BLAKE2S_OUTBYTES ) ) return -1;
if ( !key || !keylen || keylen > BLAKE2S_KEYBYTES ) return -1;
P->digest_length = (uint8_t)outlen;
P->key_length = (uint8_t)keylen;
P->fanout = 1;
P->depth = 1;
store32( &P->leaf_length, 0 );
store32( &P->node_offset, 0 );
store16( &P->xof_length, 0 );
P->node_depth = 0;
P->inner_length = 0;
/* memset(P->reserved, 0, sizeof(P->reserved) ); */
memset( P->salt, 0, sizeof( P->salt ) );
memset( P->personal, 0, sizeof( P->personal ) );
if( blake2s_init_param( S, P ) < 0 ) return -1;
{
uint8_t block[BLAKE2S_BLOCKBYTES];
memset( block, 0, BLAKE2S_BLOCKBYTES );
memcpy( block, key, keylen );
blake2s_update( S, block, BLAKE2S_BLOCKBYTES );
secure_zero_memory( block, BLAKE2S_BLOCKBYTES ); /* Burn the key from stack */
}
return 0;
}
#define G(r,i,a,b,c,d) \
do { \
a = a + b + m[blake2s_sigma[r][2*i+0]]; \
d = rotr32(d ^ a, 16); \
c = c + d; \
b = rotr32(b ^ c, 12); \
a = a + b + m[blake2s_sigma[r][2*i+1]]; \
d = rotr32(d ^ a, 8); \
c = c + d; \
b = rotr32(b ^ c, 7); \
} while(0)
#define ROUND(r) \
do { \
G(r,0,v[ 0],v[ 4],v[ 8],v[12]); \
G(r,1,v[ 1],v[ 5],v[ 9],v[13]); \
G(r,2,v[ 2],v[ 6],v[10],v[14]); \
G(r,3,v[ 3],v[ 7],v[11],v[15]); \
G(r,4,v[ 0],v[ 5],v[10],v[15]); \
G(r,5,v[ 1],v[ 6],v[11],v[12]); \
G(r,6,v[ 2],v[ 7],v[ 8],v[13]); \
G(r,7,v[ 3],v[ 4],v[ 9],v[14]); \
} while(0)
static void blake2s_compress( blake2s_state *S, const uint8_t in[BLAKE2S_BLOCKBYTES] )
{
uint32_t m[16];
uint32_t v[16];
size_t i;
for( i = 0; i < 16; ++i ) {
m[i] = load32( in + i * sizeof( m[i] ) );
}
for( i = 0; i < 8; ++i ) {
v[i] = S->h[i];
}
v[ 8] = blake2s_IV[0];
v[ 9] = blake2s_IV[1];
v[10] = blake2s_IV[2];
v[11] = blake2s_IV[3];
v[12] = S->t[0] ^ blake2s_IV[4];
v[13] = S->t[1] ^ blake2s_IV[5];
v[14] = S->f[0] ^ blake2s_IV[6];
v[15] = S->f[1] ^ blake2s_IV[7];
ROUND( 0 );
ROUND( 1 );
ROUND( 2 );
ROUND( 3 );
ROUND( 4 );
ROUND( 5 );
ROUND( 6 );
ROUND( 7 );
ROUND( 8 );
ROUND( 9 );
for( i = 0; i < 8; ++i ) {
S->h[i] = S->h[i] ^ v[i] ^ v[i + 8];
}
}
#undef G
#undef ROUND
int blake2s_update( blake2s_state *S, const void *pin, size_t inlen )
{
const unsigned char * in = (const unsigned char *)pin;
if( inlen > 0 )
{
size_t left = S->buflen;
size_t fill = BLAKE2S_BLOCKBYTES - left;
if( inlen > fill )
{
S->buflen = 0;
memcpy( S->buf + left, in, fill ); /* Fill buffer */
blake2s_increment_counter( S, BLAKE2S_BLOCKBYTES );
blake2s_compress( S, S->buf ); /* Compress */
in += fill; inlen -= fill;
while(inlen > BLAKE2S_BLOCKBYTES) {
blake2s_increment_counter(S, BLAKE2S_BLOCKBYTES);
blake2s_compress( S, in );
in += BLAKE2S_BLOCKBYTES;
inlen -= BLAKE2S_BLOCKBYTES;
}
}
memcpy( S->buf + S->buflen, in, inlen );
S->buflen += inlen;
}
return 0;
}
int blake2s_final( blake2s_state *S, void *out, size_t outlen )
{
uint8_t buffer[BLAKE2S_OUTBYTES] = {0};
size_t i;
if( out == NULL || outlen < S->outlen )
return -1;
if( blake2s_is_lastblock( S ) )
return -1;
blake2s_increment_counter( S, ( uint32_t )S->buflen );
blake2s_set_lastblock( S );
memset( S->buf + S->buflen, 0, BLAKE2S_BLOCKBYTES - S->buflen ); /* Padding */
blake2s_compress( S, S->buf );
for( i = 0; i < 8; ++i ) /* Output full hash to temp buffer */
store32( buffer + sizeof( S->h[i] ) * i, S->h[i] );
memcpy( out, buffer, outlen );
secure_zero_memory(buffer, sizeof(buffer));
return 0;
}
int blake2s( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen )
{
blake2s_state S[1];
/* Verify parameters */
if ( NULL == in && inlen > 0 ) return -1;
if ( NULL == out ) return -1;
if ( NULL == key && keylen > 0) return -1;
if( !outlen || outlen > BLAKE2S_OUTBYTES ) return -1;
if( keylen > BLAKE2S_KEYBYTES ) return -1;
if( keylen > 0 )
{
if( blake2s_init_key( S, outlen, key, keylen ) < 0 ) return -1;
}
else
{
if( blake2s_init( S, outlen ) < 0 ) return -1;
}
blake2s_update( S, ( const uint8_t * )in, inlen );
blake2s_final( S, out, outlen );
return 0;
}
#if defined(SUPERCOP)
int crypto_hash( unsigned char *out, unsigned char *in, unsigned long long inlen )
{
return blake2s( out, BLAKE2S_OUTBYTES, in, inlen, NULL, 0 );
}
#endif
#if defined(BLAKE2S_SELFTEST)
#include <string.h>
#include "blake2-kat.h"
int main( void )
{
uint8_t key[BLAKE2S_KEYBYTES];
uint8_t buf[BLAKE2_KAT_LENGTH];
size_t i, step;
for( i = 0; i < BLAKE2S_KEYBYTES; ++i )
key[i] = ( uint8_t )i;
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
buf[i] = ( uint8_t )i;
/* Test simple API */
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
{
uint8_t hash[BLAKE2S_OUTBYTES];
blake2s( hash, BLAKE2S_OUTBYTES, buf, i, key, BLAKE2S_KEYBYTES );
if( 0 != memcmp( hash, blake2s_keyed_kat[i], BLAKE2S_OUTBYTES ) )
{
goto fail;
}
}
/* Test streaming API */
for(step = 1; step < BLAKE2S_BLOCKBYTES; ++step) {
for (i = 0; i < BLAKE2_KAT_LENGTH; ++i) {
uint8_t hash[BLAKE2S_OUTBYTES];
blake2s_state S;
uint8_t * p = buf;
size_t mlen = i;
int err = 0;
if( (err = blake2s_init_key(&S, BLAKE2S_OUTBYTES, key, BLAKE2S_KEYBYTES)) < 0 ) {
goto fail;
}
while (mlen >= step) {
if ( (err = blake2s_update(&S, p, step)) < 0 ) {
goto fail;
}
mlen -= step;
p += step;
}
if ( (err = blake2s_update(&S, p, mlen)) < 0) {
goto fail;
}
if ( (err = blake2s_final(&S, hash, BLAKE2S_OUTBYTES)) < 0) {
goto fail;
}
if (0 != memcmp(hash, blake2s_keyed_kat[i], BLAKE2S_OUTBYTES)) {
goto fail;
}
}
}
puts( "ok" );
return 0;
fail:
puts("error");
return -1;
}
#endif

View File

@ -1,359 +0,0 @@
/*
BLAKE2 reference source code package - reference C implementations
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
your option. The terms of these licenses can be found at:
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
- OpenSSL license : https://www.openssl.org/source/license.html
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
More information about the BLAKE2 hash function can be found at
https://blake2.net.
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#if defined(_OPENMP)
#include <omp.h>
#endif
#include "archive_blake2.h"
#include "archive_blake2_impl.h"
#define PARALLELISM_DEGREE 8
/*
blake2sp_init_param defaults to setting the expecting output length
from the digest_length parameter block field.
In some cases, however, we do not want this, as the output length
of these instances is given by inner_length instead.
*/
static int blake2sp_init_leaf_param( blake2s_state *S, const blake2s_param *P )
{
int err = blake2s_init_param(S, P);
S->outlen = P->inner_length;
return err;
}
static int blake2sp_init_leaf( blake2s_state *S, size_t outlen, size_t keylen, uint32_t offset )
{
blake2s_param P[1];
P->digest_length = (uint8_t)outlen;
P->key_length = (uint8_t)keylen;
P->fanout = PARALLELISM_DEGREE;
P->depth = 2;
store32( &P->leaf_length, 0 );
store32( &P->node_offset, offset );
store16( &P->xof_length, 0 );
P->node_depth = 0;
P->inner_length = BLAKE2S_OUTBYTES;
memset( P->salt, 0, sizeof( P->salt ) );
memset( P->personal, 0, sizeof( P->personal ) );
return blake2sp_init_leaf_param( S, P );
}
static int blake2sp_init_root( blake2s_state *S, size_t outlen, size_t keylen )
{
blake2s_param P[1];
P->digest_length = (uint8_t)outlen;
P->key_length = (uint8_t)keylen;
P->fanout = PARALLELISM_DEGREE;
P->depth = 2;
store32( &P->leaf_length, 0 );
store32( &P->node_offset, 0 );
store16( &P->xof_length, 0 );
P->node_depth = 1;
P->inner_length = BLAKE2S_OUTBYTES;
memset( P->salt, 0, sizeof( P->salt ) );
memset( P->personal, 0, sizeof( P->personal ) );
return blake2s_init_param( S, P );
}
int blake2sp_init( blake2sp_state *S, size_t outlen )
{
size_t i;
if( !outlen || outlen > BLAKE2S_OUTBYTES ) return -1;
memset( S->buf, 0, sizeof( S->buf ) );
S->buflen = 0;
S->outlen = outlen;
if( blake2sp_init_root( S->R, outlen, 0 ) < 0 )
return -1;
for( i = 0; i < PARALLELISM_DEGREE; ++i )
if( blake2sp_init_leaf( S->S[i], outlen, 0, (uint32_t)i ) < 0 ) return -1;
S->R->last_node = 1;
S->S[PARALLELISM_DEGREE - 1]->last_node = 1;
return 0;
}
int blake2sp_init_key( blake2sp_state *S, size_t outlen, const void *key, size_t keylen )
{
size_t i;
if( !outlen || outlen > BLAKE2S_OUTBYTES ) return -1;
if( !key || !keylen || keylen > BLAKE2S_KEYBYTES ) return -1;
memset( S->buf, 0, sizeof( S->buf ) );
S->buflen = 0;
S->outlen = outlen;
if( blake2sp_init_root( S->R, outlen, keylen ) < 0 )
return -1;
for( i = 0; i < PARALLELISM_DEGREE; ++i )
if( blake2sp_init_leaf( S->S[i], outlen, keylen, (uint32_t)i ) < 0 ) return -1;
S->R->last_node = 1;
S->S[PARALLELISM_DEGREE - 1]->last_node = 1;
{
uint8_t block[BLAKE2S_BLOCKBYTES];
memset( block, 0, BLAKE2S_BLOCKBYTES );
memcpy( block, key, keylen );
for( i = 0; i < PARALLELISM_DEGREE; ++i )
blake2s_update( S->S[i], block, BLAKE2S_BLOCKBYTES );
secure_zero_memory( block, BLAKE2S_BLOCKBYTES ); /* Burn the key from stack */
}
return 0;
}
int blake2sp_update( blake2sp_state *S, const void *pin, size_t inlen )
{
const unsigned char * in = (const unsigned char *)pin;
size_t left = S->buflen;
size_t fill = sizeof( S->buf ) - left;
size_t i;
if( left && inlen >= fill )
{
memcpy( S->buf + left, in, fill );
for( i = 0; i < PARALLELISM_DEGREE; ++i )
blake2s_update( S->S[i], S->buf + i * BLAKE2S_BLOCKBYTES, BLAKE2S_BLOCKBYTES );
in += fill;
inlen -= fill;
left = 0;
}
#if defined(_OPENMP)
#pragma omp parallel shared(S), num_threads(PARALLELISM_DEGREE)
#else
for( i = 0; i < PARALLELISM_DEGREE; ++i )
#endif
{
#if defined(_OPENMP)
size_t i = omp_get_thread_num();
#endif
size_t inlen__ = inlen;
const unsigned char *in__ = ( const unsigned char * )in;
in__ += i * BLAKE2S_BLOCKBYTES;
while( inlen__ >= PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES )
{
blake2s_update( S->S[i], in__, BLAKE2S_BLOCKBYTES );
in__ += PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES;
inlen__ -= PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES;
}
}
in += inlen - inlen % ( PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES );
inlen %= PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES;
if( inlen > 0 )
memcpy( S->buf + left, in, inlen );
S->buflen = left + inlen;
return 0;
}
int blake2sp_final( blake2sp_state *S, void *out, size_t outlen )
{
uint8_t hash[PARALLELISM_DEGREE][BLAKE2S_OUTBYTES];
size_t i;
if(out == NULL || outlen < S->outlen) {
return -1;
}
for( i = 0; i < PARALLELISM_DEGREE; ++i )
{
if( S->buflen > i * BLAKE2S_BLOCKBYTES )
{
size_t left = S->buflen - i * BLAKE2S_BLOCKBYTES;
if( left > BLAKE2S_BLOCKBYTES ) left = BLAKE2S_BLOCKBYTES;
blake2s_update( S->S[i], S->buf + i * BLAKE2S_BLOCKBYTES, left );
}
blake2s_final( S->S[i], hash[i], BLAKE2S_OUTBYTES );
}
for( i = 0; i < PARALLELISM_DEGREE; ++i )
blake2s_update( S->R, hash[i], BLAKE2S_OUTBYTES );
return blake2s_final( S->R, out, S->outlen );
}
int blake2sp( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen )
{
uint8_t hash[PARALLELISM_DEGREE][BLAKE2S_OUTBYTES];
blake2s_state S[PARALLELISM_DEGREE][1];
blake2s_state FS[1];
size_t i;
/* Verify parameters */
if ( NULL == in && inlen > 0 ) return -1;
if ( NULL == out ) return -1;
if ( NULL == key && keylen > 0) return -1;
if( !outlen || outlen > BLAKE2S_OUTBYTES ) return -1;
if( keylen > BLAKE2S_KEYBYTES ) return -1;
for( i = 0; i < PARALLELISM_DEGREE; ++i )
if( blake2sp_init_leaf( S[i], outlen, keylen, (uint32_t)i ) < 0 ) return -1;
S[PARALLELISM_DEGREE - 1]->last_node = 1; /* mark last node */
if( keylen > 0 )
{
uint8_t block[BLAKE2S_BLOCKBYTES];
memset( block, 0, BLAKE2S_BLOCKBYTES );
memcpy( block, key, keylen );
for( i = 0; i < PARALLELISM_DEGREE; ++i )
blake2s_update( S[i], block, BLAKE2S_BLOCKBYTES );
secure_zero_memory( block, BLAKE2S_BLOCKBYTES ); /* Burn the key from stack */
}
#if defined(_OPENMP)
#pragma omp parallel shared(S,hash), num_threads(PARALLELISM_DEGREE)
#else
for( i = 0; i < PARALLELISM_DEGREE; ++i )
#endif
{
#if defined(_OPENMP)
size_t i = omp_get_thread_num();
#endif
size_t inlen__ = inlen;
const unsigned char *in__ = ( const unsigned char * )in;
in__ += i * BLAKE2S_BLOCKBYTES;
while( inlen__ >= PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES )
{
blake2s_update( S[i], in__, BLAKE2S_BLOCKBYTES );
in__ += PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES;
inlen__ -= PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES;
}
if( inlen__ > i * BLAKE2S_BLOCKBYTES )
{
const size_t left = inlen__ - i * BLAKE2S_BLOCKBYTES;
const size_t len = left <= BLAKE2S_BLOCKBYTES ? left : BLAKE2S_BLOCKBYTES;
blake2s_update( S[i], in__, len );
}
blake2s_final( S[i], hash[i], BLAKE2S_OUTBYTES );
}
if( blake2sp_init_root( FS, outlen, keylen ) < 0 )
return -1;
FS->last_node = 1;
for( i = 0; i < PARALLELISM_DEGREE; ++i )
blake2s_update( FS, hash[i], BLAKE2S_OUTBYTES );
return blake2s_final( FS, out, outlen );
}
#if defined(BLAKE2SP_SELFTEST)
#include <string.h>
#include "blake2-kat.h"
int main( void )
{
uint8_t key[BLAKE2S_KEYBYTES];
uint8_t buf[BLAKE2_KAT_LENGTH];
size_t i, step;
for( i = 0; i < BLAKE2S_KEYBYTES; ++i )
key[i] = ( uint8_t )i;
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
buf[i] = ( uint8_t )i;
/* Test simple API */
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
{
uint8_t hash[BLAKE2S_OUTBYTES];
blake2sp( hash, BLAKE2S_OUTBYTES, buf, i, key, BLAKE2S_KEYBYTES );
if( 0 != memcmp( hash, blake2sp_keyed_kat[i], BLAKE2S_OUTBYTES ) )
{
goto fail;
}
}
/* Test streaming API */
for(step = 1; step < BLAKE2S_BLOCKBYTES; ++step) {
for (i = 0; i < BLAKE2_KAT_LENGTH; ++i) {
uint8_t hash[BLAKE2S_OUTBYTES];
blake2sp_state S;
uint8_t * p = buf;
size_t mlen = i;
int err = 0;
if( (err = blake2sp_init_key(&S, BLAKE2S_OUTBYTES, key, BLAKE2S_KEYBYTES)) < 0 ) {
goto fail;
}
while (mlen >= step) {
if ( (err = blake2sp_update(&S, p, step)) < 0 ) {
goto fail;
}
mlen -= step;
p += step;
}
if ( (err = blake2sp_update(&S, p, mlen)) < 0) {
goto fail;
}
if ( (err = blake2sp_final(&S, hash, BLAKE2S_OUTBYTES)) < 0) {
goto fail;
}
if (0 != memcmp(hash, blake2sp_keyed_kat[i], BLAKE2S_OUTBYTES)) {
goto fail;
}
}
}
puts( "ok" );
return 0;
fail:
puts("error");
return -1;
}
#endif

View File

@ -1,175 +0,0 @@
/*-
* Copyright (c) 2003-2010 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
__FBSDID("$FreeBSD: head/lib/libarchive/archive_check_magic.c 201089 2009-12-28 02:20:23Z kientzle $");
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <windows.h>
#include <winbase.h>
#endif
#include "archive_private.h"
static void
errmsg(const char *m)
{
size_t s = strlen(m);
ssize_t written;
while (s > 0) {
written = write(2, m, strlen(m));
if (written <= 0)
return;
m += written;
s -= written;
}
}
static __LA_DEAD void
diediedie(void)
{
#if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG)
/* Cause a breakpoint exception */
DebugBreak();
#endif
abort(); /* Terminate the program abnormally. */
}
static const char *
state_name(unsigned s)
{
switch (s) {
case ARCHIVE_STATE_NEW: return ("new");
case ARCHIVE_STATE_HEADER: return ("header");
case ARCHIVE_STATE_DATA: return ("data");
case ARCHIVE_STATE_EOF: return ("eof");
case ARCHIVE_STATE_CLOSED: return ("closed");
case ARCHIVE_STATE_FATAL: return ("fatal");
default: return ("??");
}
}
static const char *
archive_handle_type_name(unsigned m)
{
switch (m) {
case ARCHIVE_WRITE_MAGIC: return ("archive_write");
case ARCHIVE_READ_MAGIC: return ("archive_read");
case ARCHIVE_WRITE_DISK_MAGIC: return ("archive_write_disk");
case ARCHIVE_READ_DISK_MAGIC: return ("archive_read_disk");
case ARCHIVE_MATCH_MAGIC: return ("archive_match");
default: return NULL;
}
}
static char *
write_all_states(char *buff, unsigned int states)
{
unsigned int lowbit;
buff[0] = '\0';
/* A trick for computing the lowest set bit. */
while ((lowbit = states & (1 + ~states)) != 0) {
states &= ~lowbit; /* Clear the low bit. */
strcat(buff, state_name(lowbit));
if (states != 0)
strcat(buff, "/");
}
return buff;
}
/*
* Check magic value and current state.
* Magic value mismatches are fatal and result in calls to abort().
* State mismatches return ARCHIVE_FATAL.
* Otherwise, returns ARCHIVE_OK.
*
* This is designed to catch serious programming errors that violate
* the libarchive API.
*/
int
__archive_check_magic(struct archive *a, unsigned int magic,
unsigned int state, const char *function)
{
char states1[64];
char states2[64];
const char *handle_type;
/*
* If this isn't some form of archive handle,
* then the library user has screwed up so bad that
* we don't even have a reliable way to report an error.
*/
handle_type = archive_handle_type_name(a->magic);
if (!handle_type) {
errmsg("PROGRAMMER ERROR: Function ");
errmsg(function);
errmsg(" invoked with invalid archive handle.\n");
diediedie();
}
if (a->magic != magic) {
archive_set_error(a, -1,
"PROGRAMMER ERROR: Function '%s' invoked"
" on '%s' archive object, which is not supported.",
function,
handle_type);
a->state = ARCHIVE_STATE_FATAL;
return (ARCHIVE_FATAL);
}
if ((a->state & state) == 0) {
/* If we're already FATAL, don't overwrite the error. */
if (a->state != ARCHIVE_STATE_FATAL)
archive_set_error(a, -1,
"INTERNAL ERROR: Function '%s' invoked with"
" archive structure in state '%s',"
" should be in state '%s'",
function,
write_all_states(states1, a->state),
write_all_states(states2, state));
a->state = ARCHIVE_STATE_FATAL;
return (ARCHIVE_FATAL);
}
return ARCHIVE_OK;
}

View File

@ -1,227 +0,0 @@
/*-
* Copyright (c) 2012 Michihiro NAKAJIMA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
__FBSDID("$FreeBSD$");
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include "archive.h"
#include "archive_cmdline_private.h"
#include "archive_string.h"
static int cmdline_set_path(struct archive_cmdline *, const char *);
static int cmdline_add_arg(struct archive_cmdline *, const char *);
static ssize_t
extract_quotation(struct archive_string *as, const char *p)
{
const char *s;
for (s = p + 1; *s;) {
if (*s == '\\') {
if (s[1] != '\0') {
archive_strappend_char(as, s[1]);
s += 2;
} else
s++;
} else if (*s == '"')
break;
else {
archive_strappend_char(as, s[0]);
s++;
}
}
if (*s != '"')
return (ARCHIVE_FAILED);/* Invalid sequence. */
return ((ssize_t)(s + 1 - p));
}
static ssize_t
get_argument(struct archive_string *as, const char *p)
{
const char *s = p;
archive_string_empty(as);
/* Skip beginning space characters. */
while (*s != '\0' && *s == ' ')
s++;
/* Copy non-space characters. */
while (*s != '\0' && *s != ' ') {
if (*s == '\\') {
if (s[1] != '\0') {
archive_strappend_char(as, s[1]);
s += 2;
} else {
s++;/* Ignore this character.*/
break;
}
} else if (*s == '"') {
ssize_t q = extract_quotation(as, s);
if (q < 0)
return (ARCHIVE_FAILED);/* Invalid sequence. */
s += q;
} else {
archive_strappend_char(as, s[0]);
s++;
}
}
return ((ssize_t)(s - p));
}
/*
* Set up command line arguments.
* Returns ARCHIVE_OK if everything okey.
* Returns ARCHIVE_FAILED if there is a lack of the `"' terminator or an
* empty command line.
* Returns ARCHIVE_FATAL if no memory.
*/
int
__archive_cmdline_parse(struct archive_cmdline *data, const char *cmd)
{
struct archive_string as;
const char *p;
ssize_t al;
int r;
archive_string_init(&as);
/* Get first argument as a command path. */
al = get_argument(&as, cmd);
if (al < 0) {
r = ARCHIVE_FAILED;/* Invalid sequence. */
goto exit_function;
}
if (archive_strlen(&as) == 0) {
r = ARCHIVE_FAILED;/* An empty command path. */
goto exit_function;
}
r = cmdline_set_path(data, as.s);
if (r != ARCHIVE_OK)
goto exit_function;
p = strrchr(as.s, '/');
if (p == NULL)
p = as.s;
else
p++;
r = cmdline_add_arg(data, p);
if (r != ARCHIVE_OK)
goto exit_function;
cmd += al;
for (;;) {
al = get_argument(&as, cmd);
if (al < 0) {
r = ARCHIVE_FAILED;/* Invalid sequence. */
goto exit_function;
}
if (al == 0)
break;
cmd += al;
if (archive_strlen(&as) == 0 && *cmd == '\0')
break;
r = cmdline_add_arg(data, as.s);
if (r != ARCHIVE_OK)
goto exit_function;
}
r = ARCHIVE_OK;
exit_function:
archive_string_free(&as);
return (r);
}
/*
* Set the program path.
*/
static int
cmdline_set_path(struct archive_cmdline *data, const char *path)
{
char *newptr;
newptr = realloc(data->path, strlen(path) + 1);
if (newptr == NULL)
return (ARCHIVE_FATAL);
data->path = newptr;
strcpy(data->path, path);
return (ARCHIVE_OK);
}
/*
* Add a argument for the program.
*/
static int
cmdline_add_arg(struct archive_cmdline *data, const char *arg)
{
char **newargv;
if (data->path == NULL)
return (ARCHIVE_FAILED);
newargv = realloc(data->argv, (data->argc + 2) * sizeof(char *));
if (newargv == NULL)
return (ARCHIVE_FATAL);
data->argv = newargv;
data->argv[data->argc] = strdup(arg);
if (data->argv[data->argc] == NULL)
return (ARCHIVE_FATAL);
/* Set the terminator of argv. */
data->argv[++data->argc] = NULL;
return (ARCHIVE_OK);
}
struct archive_cmdline *
__archive_cmdline_allocate(void)
{
return (struct archive_cmdline *)
calloc(1, sizeof(struct archive_cmdline));
}
/*
* Release the resources.
*/
int
__archive_cmdline_free(struct archive_cmdline *data)
{
if (data) {
free(data->path);
if (data->argv != NULL) {
int i;
for (i = 0; data->argv[i] != NULL; i++)
free(data->argv[i]);
free(data->argv);
}
free(data);
}
return (ARCHIVE_OK);
}

View File

@ -1,47 +0,0 @@
/*-
* Copyright (c) 2012 Michihiro NAKAJIMA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef ARCHIVE_CMDLINE_PRIVATE_H
#define ARCHIVE_CMDLINE_PRIVATE_H
#ifndef __LIBARCHIVE_BUILD
#ifndef __LIBARCHIVE_TEST
#error This header is only to be used internally to libarchive.
#endif
#endif
struct archive_cmdline {
char *path;
char **argv;
int argc;
};
struct archive_cmdline *__archive_cmdline_allocate(void);
int __archive_cmdline_parse(struct archive_cmdline *, const char *);
int __archive_cmdline_free(struct archive_cmdline *);
#endif

View File

@ -1,83 +0,0 @@
/*-
* Copyright (c) 2009 Joerg Sonnenberger
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: head/lib/libarchive/archive_crc32.h 201102 2009-12-28 03:11:36Z kientzle $
*/
#ifndef ARCHIVE_CRC32_H
#define ARCHIVE_CRC32_H
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
/*
* When zlib is unavailable, we should still be able to validate
* uncompressed zip archives. That requires us to be able to compute
* the CRC32 check value. This is a drop-in compatible replacement
* for crc32() from zlib. It's slower than the zlib implementation,
* but still pretty fast: This runs about 300MB/s on my 3GHz P4
* compared to about 800MB/s for the zlib implementation.
*/
static unsigned long
crc32(unsigned long crc, const void *_p, size_t len)
{
unsigned long crc2, b, i;
const unsigned char *p = _p;
static volatile int crc_tbl_inited = 0;
static unsigned long crc_tbl[256];
if (!crc_tbl_inited) {
for (b = 0; b < 256; ++b) {
crc2 = b;
for (i = 8; i > 0; --i) {
if (crc2 & 1)
crc2 = (crc2 >> 1) ^ 0xedb88320UL;
else
crc2 = (crc2 >> 1);
}
crc_tbl[b] = crc2;
}
crc_tbl_inited = 1;
}
crc = crc ^ 0xffffffffUL;
/* A use of this loop is about 20% - 30% faster than
* no use version in any optimization option of gcc. */
for (;len >= 8; len -= 8) {
crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
}
while (len--)
crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
return (crc ^ 0xffffffffUL);
}
#endif

View File

@ -1,519 +0,0 @@
/*-
* Copyright (c) 2014 Michihiro NAKAJIMA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "archive.h"
#include "archive_cryptor_private.h"
/*
* On systems that do not support any recognized crypto libraries,
* this file will normally define no usable symbols.
*
* But some compilers and linkers choke on empty object files, so
* define a public symbol that will always exist. This could
* be removed someday if this file gains another always-present
* symbol definition.
*/
int __libarchive_cryptor_build_hack(void) {
return 0;
}
#ifdef ARCHIVE_CRYPTOR_USE_Apple_CommonCrypto
static int
pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt,
size_t salt_len, unsigned rounds, uint8_t *derived_key,
size_t derived_key_len)
{
CCKeyDerivationPBKDF(kCCPBKDF2, (const char *)pw,
pw_len, salt, salt_len, kCCPRFHmacAlgSHA1, rounds,
derived_key, derived_key_len);
return 0;
}
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
#ifdef _MSC_VER
#pragma comment(lib, "Bcrypt.lib")
#endif
static int
pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt,
size_t salt_len, unsigned rounds, uint8_t *derived_key,
size_t derived_key_len)
{
NTSTATUS status;
BCRYPT_ALG_HANDLE hAlg;
status = BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_SHA1_ALGORITHM,
MS_PRIMITIVE_PROVIDER, BCRYPT_ALG_HANDLE_HMAC_FLAG);
if (!BCRYPT_SUCCESS(status))
return -1;
status = BCryptDeriveKeyPBKDF2(hAlg,
(PUCHAR)(uintptr_t)pw, (ULONG)pw_len,
(PUCHAR)(uintptr_t)salt, (ULONG)salt_len, rounds,
(PUCHAR)derived_key, (ULONG)derived_key_len, 0);
BCryptCloseAlgorithmProvider(hAlg, 0);
return (BCRYPT_SUCCESS(status)) ? 0: -1;
}
#elif defined(HAVE_LIBMBEDCRYPTO) && defined(HAVE_MBEDTLS_PKCS5_H)
static int
pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt,
size_t salt_len, unsigned rounds, uint8_t *derived_key,
size_t derived_key_len)
{
mbedtls_md_context_t ctx;
const mbedtls_md_info_t *info;
int ret;
mbedtls_md_init(&ctx);
info = mbedtls_md_info_from_type(MBEDTLS_MD_SHA1);
if (info == NULL) {
mbedtls_md_free(&ctx);
return (-1);
}
ret = mbedtls_md_setup(&ctx, info, 1);
if (ret != 0) {
mbedtls_md_free(&ctx);
return (-1);
}
ret = mbedtls_pkcs5_pbkdf2_hmac(&ctx, (const unsigned char *)pw,
pw_len, salt, salt_len, rounds, derived_key_len, derived_key);
mbedtls_md_free(&ctx);
return (ret);
}
#elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_PBKDF2_H)
static int
pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt,
size_t salt_len, unsigned rounds, uint8_t *derived_key,
size_t derived_key_len) {
pbkdf2_hmac_sha1((unsigned)pw_len, (const uint8_t *)pw, rounds,
salt_len, salt, derived_key_len, derived_key);
return 0;
}
#elif defined(HAVE_LIBCRYPTO) && defined(HAVE_PKCS5_PBKDF2_HMAC_SHA1)
static int
pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt,
size_t salt_len, unsigned rounds, uint8_t *derived_key,
size_t derived_key_len) {
PKCS5_PBKDF2_HMAC_SHA1(pw, pw_len, salt, salt_len, rounds,
derived_key_len, derived_key);
return 0;
}
#else
/* Stub */
static int
pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt,
size_t salt_len, unsigned rounds, uint8_t *derived_key,
size_t derived_key_len) {
(void)pw; /* UNUSED */
(void)pw_len; /* UNUSED */
(void)salt; /* UNUSED */
(void)salt_len; /* UNUSED */
(void)rounds; /* UNUSED */
(void)derived_key; /* UNUSED */
(void)derived_key_len; /* UNUSED */
return -1; /* UNSUPPORTED */
}
#endif
#ifdef ARCHIVE_CRYPTOR_USE_Apple_CommonCrypto
# if MAC_OS_X_VERSION_MAX_ALLOWED < 1090
# define kCCAlgorithmAES kCCAlgorithmAES128
# endif
static int
aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
{
CCCryptorStatus r;
ctx->key_len = key_len;
memcpy(ctx->key, key, key_len);
memset(ctx->nonce, 0, sizeof(ctx->nonce));
ctx->encr_pos = AES_BLOCK_SIZE;
r = CCCryptorCreateWithMode(kCCEncrypt, kCCModeECB, kCCAlgorithmAES,
ccNoPadding, NULL, key, key_len, NULL, 0, 0, 0, &ctx->ctx);
return (r == kCCSuccess)? 0: -1;
}
static int
aes_ctr_encrypt_counter(archive_crypto_ctx *ctx)
{
CCCryptorRef ref = ctx->ctx;
CCCryptorStatus r;
r = CCCryptorReset(ref, NULL);
if (r != kCCSuccess && r != kCCUnimplemented)
return -1;
r = CCCryptorUpdate(ref, ctx->nonce, AES_BLOCK_SIZE, ctx->encr_buf,
AES_BLOCK_SIZE, NULL);
return (r == kCCSuccess)? 0: -1;
}
static int
aes_ctr_release(archive_crypto_ctx *ctx)
{
memset(ctx->key, 0, ctx->key_len);
memset(ctx->nonce, 0, sizeof(ctx->nonce));
return 0;
}
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
static int
aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
{
BCRYPT_ALG_HANDLE hAlg;
BCRYPT_KEY_HANDLE hKey;
DWORD keyObj_len, aes_key_len;
PBYTE keyObj;
ULONG result;
NTSTATUS status;
BCRYPT_KEY_LENGTHS_STRUCT key_lengths;
ctx->hAlg = NULL;
ctx->hKey = NULL;
ctx->keyObj = NULL;
switch (key_len) {
case 16: aes_key_len = 128; break;
case 24: aes_key_len = 192; break;
case 32: aes_key_len = 256; break;
default: return -1;
}
status = BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_AES_ALGORITHM,
MS_PRIMITIVE_PROVIDER, 0);
if (!BCRYPT_SUCCESS(status))
return -1;
status = BCryptGetProperty(hAlg, BCRYPT_KEY_LENGTHS, (PUCHAR)&key_lengths,
sizeof(key_lengths), &result, 0);
if (!BCRYPT_SUCCESS(status)) {
BCryptCloseAlgorithmProvider(hAlg, 0);
return -1;
}
if (key_lengths.dwMinLength > aes_key_len
|| key_lengths.dwMaxLength < aes_key_len) {
BCryptCloseAlgorithmProvider(hAlg, 0);
return -1;
}
status = BCryptGetProperty(hAlg, BCRYPT_OBJECT_LENGTH, (PUCHAR)&keyObj_len,
sizeof(keyObj_len), &result, 0);
if (!BCRYPT_SUCCESS(status)) {
BCryptCloseAlgorithmProvider(hAlg, 0);
return -1;
}
keyObj = (PBYTE)HeapAlloc(GetProcessHeap(), 0, keyObj_len);
if (keyObj == NULL) {
BCryptCloseAlgorithmProvider(hAlg, 0);
return -1;
}
status = BCryptSetProperty(hAlg, BCRYPT_CHAINING_MODE,
(PUCHAR)BCRYPT_CHAIN_MODE_ECB, sizeof(BCRYPT_CHAIN_MODE_ECB), 0);
if (!BCRYPT_SUCCESS(status)) {
BCryptCloseAlgorithmProvider(hAlg, 0);
HeapFree(GetProcessHeap(), 0, keyObj);
return -1;
}
status = BCryptGenerateSymmetricKey(hAlg, &hKey,
keyObj, keyObj_len,
(PUCHAR)(uintptr_t)key, (ULONG)key_len, 0);
if (!BCRYPT_SUCCESS(status)) {
BCryptCloseAlgorithmProvider(hAlg, 0);
HeapFree(GetProcessHeap(), 0, keyObj);
return -1;
}
ctx->hAlg = hAlg;
ctx->hKey = hKey;
ctx->keyObj = keyObj;
ctx->keyObj_len = keyObj_len;
ctx->encr_pos = AES_BLOCK_SIZE;
return 0;
}
static int
aes_ctr_encrypt_counter(archive_crypto_ctx *ctx)
{
NTSTATUS status;
ULONG result;
status = BCryptEncrypt(ctx->hKey, (PUCHAR)ctx->nonce, AES_BLOCK_SIZE,
NULL, NULL, 0, (PUCHAR)ctx->encr_buf, AES_BLOCK_SIZE,
&result, 0);
return BCRYPT_SUCCESS(status) ? 0 : -1;
}
static int
aes_ctr_release(archive_crypto_ctx *ctx)
{
if (ctx->hAlg != NULL) {
BCryptCloseAlgorithmProvider(ctx->hAlg, 0);
ctx->hAlg = NULL;
BCryptDestroyKey(ctx->hKey);
ctx->hKey = NULL;
HeapFree(GetProcessHeap(), 0, ctx->keyObj);
ctx->keyObj = NULL;
}
memset(ctx, 0, sizeof(*ctx));
return 0;
}
#elif defined(HAVE_LIBMBEDCRYPTO) && defined(HAVE_MBEDTLS_AES_H)
static int
aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
{
mbedtls_aes_init(&ctx->ctx);
ctx->key_len = key_len;
memcpy(ctx->key, key, key_len);
memset(ctx->nonce, 0, sizeof(ctx->nonce));
ctx->encr_pos = AES_BLOCK_SIZE;
return 0;
}
static int
aes_ctr_encrypt_counter(archive_crypto_ctx *ctx)
{
if (mbedtls_aes_setkey_enc(&ctx->ctx, ctx->key,
ctx->key_len * 8) != 0)
return (-1);
if (mbedtls_aes_crypt_ecb(&ctx->ctx, MBEDTLS_AES_ENCRYPT, ctx->nonce,
ctx->encr_buf) != 0)
return (-1);
return 0;
}
static int
aes_ctr_release(archive_crypto_ctx *ctx)
{
mbedtls_aes_free(&ctx->ctx);
memset(ctx, 0, sizeof(*ctx));
return 0;
}
#elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_AES_H)
static int
aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
{
ctx->key_len = key_len;
memcpy(ctx->key, key, key_len);
memset(ctx->nonce, 0, sizeof(ctx->nonce));
ctx->encr_pos = AES_BLOCK_SIZE;
memset(&ctx->ctx, 0, sizeof(ctx->ctx));
return 0;
}
static int
aes_ctr_encrypt_counter(archive_crypto_ctx *ctx)
{
aes_set_encrypt_key(&ctx->ctx, ctx->key_len, ctx->key);
aes_encrypt(&ctx->ctx, AES_BLOCK_SIZE, ctx->encr_buf, ctx->nonce);
return 0;
}
static int
aes_ctr_release(archive_crypto_ctx *ctx)
{
memset(ctx, 0, sizeof(*ctx));
return 0;
}
#elif defined(HAVE_LIBCRYPTO)
static int
aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
{
if ((ctx->ctx = EVP_CIPHER_CTX_new()) == NULL)
return -1;
switch (key_len) {
case 16: ctx->type = EVP_aes_128_ecb(); break;
case 24: ctx->type = EVP_aes_192_ecb(); break;
case 32: ctx->type = EVP_aes_256_ecb(); break;
default: ctx->type = NULL; return -1;
}
ctx->key_len = key_len;
memcpy(ctx->key, key, key_len);
memset(ctx->nonce, 0, sizeof(ctx->nonce));
ctx->encr_pos = AES_BLOCK_SIZE;
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
if (!EVP_CIPHER_CTX_reset(ctx->ctx)) {
EVP_CIPHER_CTX_free(ctx->ctx);
ctx->ctx = NULL;
}
#else
EVP_CIPHER_CTX_init(ctx->ctx);
#endif
return 0;
}
static int
aes_ctr_encrypt_counter(archive_crypto_ctx *ctx)
{
int outl = 0;
int r;
r = EVP_EncryptInit_ex(ctx->ctx, ctx->type, NULL, ctx->key, NULL);
if (r == 0)
return -1;
r = EVP_EncryptUpdate(ctx->ctx, ctx->encr_buf, &outl, ctx->nonce,
AES_BLOCK_SIZE);
if (r == 0 || outl != AES_BLOCK_SIZE)
return -1;
return 0;
}
static int
aes_ctr_release(archive_crypto_ctx *ctx)
{
EVP_CIPHER_CTX_free(ctx->ctx);
memset(ctx->key, 0, ctx->key_len);
memset(ctx->nonce, 0, sizeof(ctx->nonce));
return 0;
}
#else
#define ARCHIVE_CRYPTOR_STUB
/* Stub */
static int
aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
{
(void)ctx; /* UNUSED */
(void)key; /* UNUSED */
(void)key_len; /* UNUSED */
return -1;
}
static int
aes_ctr_encrypt_counter(archive_crypto_ctx *ctx)
{
(void)ctx; /* UNUSED */
return -1;
}
static int
aes_ctr_release(archive_crypto_ctx *ctx)
{
(void)ctx; /* UNUSED */
return 0;
}
#endif
#ifdef ARCHIVE_CRYPTOR_STUB
static int
aes_ctr_update(archive_crypto_ctx *ctx, const uint8_t * const in,
size_t in_len, uint8_t * const out, size_t *out_len)
{
(void)ctx; /* UNUSED */
(void)in; /* UNUSED */
(void)in_len; /* UNUSED */
(void)out; /* UNUSED */
(void)out_len; /* UNUSED */
aes_ctr_encrypt_counter(ctx); /* UNUSED */ /* Fix unused function warning */
return -1;
}
#else
static void
aes_ctr_increase_counter(archive_crypto_ctx *ctx)
{
uint8_t *const nonce = ctx->nonce;
int j;
for (j = 0; j < 8; j++) {
if (++nonce[j])
break;
}
}
static int
aes_ctr_update(archive_crypto_ctx *ctx, const uint8_t * const in,
size_t in_len, uint8_t * const out, size_t *out_len)
{
uint8_t *const ebuf = ctx->encr_buf;
unsigned pos = ctx->encr_pos;
unsigned max = (unsigned)((in_len < *out_len)? in_len: *out_len);
unsigned i;
for (i = 0; i < max; ) {
if (pos == AES_BLOCK_SIZE) {
aes_ctr_increase_counter(ctx);
if (aes_ctr_encrypt_counter(ctx) != 0)
return -1;
while (max -i >= AES_BLOCK_SIZE) {
for (pos = 0; pos < AES_BLOCK_SIZE; pos++)
out[i+pos] = in[i+pos] ^ ebuf[pos];
i += AES_BLOCK_SIZE;
aes_ctr_increase_counter(ctx);
if (aes_ctr_encrypt_counter(ctx) != 0)
return -1;
}
pos = 0;
if (i >= max)
break;
}
out[i] = in[i] ^ ebuf[pos++];
i++;
}
ctx->encr_pos = pos;
*out_len = i;
return 0;
}
#endif /* ARCHIVE_CRYPTOR_STUB */
const struct archive_cryptor __archive_cryptor =
{
&pbkdf2_sha1,
&aes_ctr_init,
&aes_ctr_update,
&aes_ctr_release,
&aes_ctr_init,
&aes_ctr_update,
&aes_ctr_release,
};

View File

@ -1,179 +0,0 @@
/*-
* Copyright (c) 2014 Michihiro NAKAJIMA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ARCHIVE_CRYPTOR_PRIVATE_H_INCLUDED
#define ARCHIVE_CRYPTOR_PRIVATE_H_INCLUDED
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
/*
* On systems that do not support any recognized crypto libraries,
* the archive_cryptor.c file will normally define no usable symbols.
*
* But some compilers and linkers choke on empty object files, so
* define a public symbol that will always exist. This could
* be removed someday if this file gains another always-present
* symbol definition.
*/
int __libarchive_cryptor_build_hack(void);
#ifdef __APPLE__
# include <AvailabilityMacros.h>
# if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
# define ARCHIVE_CRYPTOR_USE_Apple_CommonCrypto
# endif
#endif
#ifdef ARCHIVE_CRYPTOR_USE_Apple_CommonCrypto
#include <CommonCrypto/CommonCryptor.h>
#include <CommonCrypto/CommonKeyDerivation.h>
#define AES_BLOCK_SIZE 16
#define AES_MAX_KEY_SIZE kCCKeySizeAES256
typedef struct {
CCCryptorRef ctx;
uint8_t key[AES_MAX_KEY_SIZE];
unsigned key_len;
uint8_t nonce[AES_BLOCK_SIZE];
uint8_t encr_buf[AES_BLOCK_SIZE];
unsigned encr_pos;
} archive_crypto_ctx;
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
#include <bcrypt.h>
/* Common in other bcrypt implementations, but missing from VS2008. */
#ifndef BCRYPT_SUCCESS
#define BCRYPT_SUCCESS(r) ((NTSTATUS)(r) == STATUS_SUCCESS)
#endif
#define AES_MAX_KEY_SIZE 32
#define AES_BLOCK_SIZE 16
typedef struct {
BCRYPT_ALG_HANDLE hAlg;
BCRYPT_KEY_HANDLE hKey;
PBYTE keyObj;
DWORD keyObj_len;
uint8_t nonce[AES_BLOCK_SIZE];
uint8_t encr_buf[AES_BLOCK_SIZE];
unsigned encr_pos;
} archive_crypto_ctx;
#elif defined(HAVE_LIBMBEDCRYPTO) && defined(HAVE_MBEDTLS_AES_H)
#include <mbedtls/aes.h>
#include <mbedtls/md.h>
#include <mbedtls/pkcs5.h>
#define AES_MAX_KEY_SIZE 32
#define AES_BLOCK_SIZE 16
typedef struct {
mbedtls_aes_context ctx;
uint8_t key[AES_MAX_KEY_SIZE];
unsigned key_len;
uint8_t nonce[AES_BLOCK_SIZE];
uint8_t encr_buf[AES_BLOCK_SIZE];
unsigned encr_pos;
} archive_crypto_ctx;
#elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_AES_H)
#if defined(HAVE_NETTLE_PBKDF2_H)
#include <nettle/pbkdf2.h>
#endif
#include <nettle/aes.h>
typedef struct {
struct aes_ctx ctx;
uint8_t key[AES_MAX_KEY_SIZE];
unsigned key_len;
uint8_t nonce[AES_BLOCK_SIZE];
uint8_t encr_buf[AES_BLOCK_SIZE];
unsigned encr_pos;
} archive_crypto_ctx;
#elif defined(HAVE_LIBCRYPTO)
#include "archive_openssl_evp_private.h"
#define AES_BLOCK_SIZE 16
#define AES_MAX_KEY_SIZE 32
typedef struct {
EVP_CIPHER_CTX *ctx;
const EVP_CIPHER *type;
uint8_t key[AES_MAX_KEY_SIZE];
unsigned key_len;
uint8_t nonce[AES_BLOCK_SIZE];
uint8_t encr_buf[AES_BLOCK_SIZE];
unsigned encr_pos;
} archive_crypto_ctx;
#else
#define AES_BLOCK_SIZE 16
#define AES_MAX_KEY_SIZE 32
typedef int archive_crypto_ctx;
#endif
/* defines */
#define archive_pbkdf2_sha1(pw, pw_len, salt, salt_len, rounds, dk, dk_len)\
__archive_cryptor.pbkdf2sha1(pw, pw_len, salt, salt_len, rounds, dk, dk_len)
#define archive_decrypto_aes_ctr_init(ctx, key, key_len) \
__archive_cryptor.decrypto_aes_ctr_init(ctx, key, key_len)
#define archive_decrypto_aes_ctr_update(ctx, in, in_len, out, out_len) \
__archive_cryptor.decrypto_aes_ctr_update(ctx, in, in_len, out, out_len)
#define archive_decrypto_aes_ctr_release(ctx) \
__archive_cryptor.decrypto_aes_ctr_release(ctx)
#define archive_encrypto_aes_ctr_init(ctx, key, key_len) \
__archive_cryptor.encrypto_aes_ctr_init(ctx, key, key_len)
#define archive_encrypto_aes_ctr_update(ctx, in, in_len, out, out_len) \
__archive_cryptor.encrypto_aes_ctr_update(ctx, in, in_len, out, out_len)
#define archive_encrypto_aes_ctr_release(ctx) \
__archive_cryptor.encrypto_aes_ctr_release(ctx)
/* Minimal interface to cryptographic functionality for internal use in
* libarchive */
struct archive_cryptor
{
/* PKCS5 PBKDF2 HMAC-SHA1 */
int (*pbkdf2sha1)(const char *pw, size_t pw_len, const uint8_t *salt,
size_t salt_len, unsigned rounds, uint8_t *derived_key,
size_t derived_key_len);
/* AES CTR mode(little endian version) */
int (*decrypto_aes_ctr_init)(archive_crypto_ctx *, const uint8_t *, size_t);
int (*decrypto_aes_ctr_update)(archive_crypto_ctx *, const uint8_t *,
size_t, uint8_t *, size_t *);
int (*decrypto_aes_ctr_release)(archive_crypto_ctx *);
int (*encrypto_aes_ctr_init)(archive_crypto_ctx *, const uint8_t *, size_t);
int (*encrypto_aes_ctr_update)(archive_crypto_ctx *, const uint8_t *,
size_t, uint8_t *, size_t *);
int (*encrypto_aes_ctr_release)(archive_crypto_ctx *);
};
extern const struct archive_cryptor __archive_cryptor;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,412 +0,0 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* Copyright (c) 2011 Andres Mejia
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ARCHIVE_DIGEST_PRIVATE_H_INCLUDED
#define ARCHIVE_DIGEST_PRIVATE_H_INCLUDED
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
/*
* Crypto support in various Operating Systems:
*
* NetBSD:
* - MD5 and SHA1 in libc: without _ after algorithm name
* - SHA2 in libc: with _ after algorithm name
*
* OpenBSD:
* - MD5, SHA1 and SHA2 in libc: without _ after algorithm name
* - OpenBSD 4.4 and earlier have SHA2 in libc with _ after algorithm name
*
* DragonFly and FreeBSD:
* - MD5 libmd: without _ after algorithm name
* - SHA1, SHA256 and SHA512 in libmd: with _ after algorithm name
*
* Mac OS X (10.4 and later):
* - MD5, SHA1 and SHA2 in libSystem: with CC_ prefix and _ after algorithm name
*
* OpenSSL:
* - MD5, SHA1 and SHA2 in libcrypto: with _ after algorithm name
*
* Windows:
* - MD5, SHA1 and SHA2 in archive_crypto.c using Windows crypto API
*/
/* libc crypto headers */
#if defined(ARCHIVE_CRYPTO_MD5_LIBC)
#include <md5.h>
#endif
#if defined(ARCHIVE_CRYPTO_RMD160_LIBC)
#include <rmd160.h>
#endif
#if defined(ARCHIVE_CRYPTO_SHA1_LIBC)
#include <sha1.h>
#endif
#if defined(ARCHIVE_CRYPTO_SHA256_LIBC) ||\
defined(ARCHIVE_CRYPTO_SHA256_LIBC2) ||\
defined(ARCHIVE_CRYPTO_SHA256_LIBC3) ||\
defined(ARCHIVE_CRYPTO_SHA384_LIBC) ||\
defined(ARCHIVE_CRYPTO_SHA384_LIBC2) ||\
defined(ARCHIVE_CRYPTO_SHA384_LIBC3) ||\
defined(ARCHIVE_CRYPTO_SHA512_LIBC) ||\
defined(ARCHIVE_CRYPTO_SHA512_LIBC2) ||\
defined(ARCHIVE_CRYPTO_SHA512_LIBC3)
#include <sha2.h>
#endif
/* libmd crypto headers */
#if defined(ARCHIVE_CRYPTO_MD5_LIBMD) ||\
defined(ARCHIVE_CRYPTO_RMD160_LIBMD) ||\
defined(ARCHIVE_CRYPTO_SHA1_LIBMD) ||\
defined(ARCHIVE_CRYPTO_SHA256_LIBMD) ||\
defined(ARCHIVE_CRYPTO_SHA512_LIBMD)
#define ARCHIVE_CRYPTO_LIBMD 1
#endif
#if defined(ARCHIVE_CRYPTO_MD5_LIBMD)
#include <md5.h>
#endif
#if defined(ARCHIVE_CRYPTO_RMD160_LIBMD)
#include <ripemd.h>
#endif
#if defined(ARCHIVE_CRYPTO_SHA1_LIBMD)
#include <sha.h>
#endif
#if defined(ARCHIVE_CRYPTO_SHA256_LIBMD)
#include <sha256.h>
#endif
#if defined(ARCHIVE_CRYPTO_SHA512_LIBMD)
#include <sha512.h>
#endif
/* libSystem crypto headers */
#if defined(ARCHIVE_CRYPTO_MD5_LIBSYSTEM) ||\
defined(ARCHIVE_CRYPTO_SHA1_LIBSYSTEM) ||\
defined(ARCHIVE_CRYPTO_SHA256_LIBSYSTEM) ||\
defined(ARCHIVE_CRYPTO_SHA384_LIBSYSTEM) ||\
defined(ARCHIVE_CRYPTO_SHA512_LIBSYSTEM)
#include <CommonCrypto/CommonDigest.h>
#endif
/* mbed TLS crypto headers */
#if defined(ARCHIVE_CRYPTO_MD5_MBEDTLS)
#include <mbedtls/md5.h>
#endif
#if defined(ARCHIVE_CRYPTO_RMD160_MBEDTLS)
#include <mbedtls/ripemd160.h>
#endif
#if defined(ARCHIVE_CRYPTO_SHA1_MBEDTLS)
#include <mbedtls/sha1.h>
#endif
#if defined(ARCHIVE_CRYPTO_SHA256_MBEDTLS)
#include <mbedtls/sha256.h>
#endif
#if defined(ARCHIVE_CRYPTO_SHA384_MBEDTLS) ||\
defined(ARCHIVE_CRYPTO_SHA512_MBEDTLS)
#include <mbedtls/sha512.h>
#endif
/* Nettle crypto headers */
#if defined(ARCHIVE_CRYPTO_MD5_NETTLE)
#include <nettle/md5.h>
#endif
#if defined(ARCHIVE_CRYPTO_RMD160_NETTLE)
#include <nettle/ripemd160.h>
#endif
#if defined(ARCHIVE_CRYPTO_SHA1_NETTLE) ||\
defined(ARCHIVE_CRYPTO_SHA256_NETTLE) ||\
defined(ARCHIVE_CRYPTO_SHA384_NETTLE) ||\
defined(ARCHIVE_CRYPTO_SHA512_NETTLE)
#include <nettle/sha.h>
#endif
/* OpenSSL crypto headers */
#if defined(ARCHIVE_CRYPTO_MD5_OPENSSL) ||\
defined(ARCHIVE_CRYPTO_RMD160_OPENSSL) ||\
defined(ARCHIVE_CRYPTO_SHA1_OPENSSL) ||\
defined(ARCHIVE_CRYPTO_SHA256_OPENSSL) ||\
defined(ARCHIVE_CRYPTO_SHA384_OPENSSL) ||\
defined(ARCHIVE_CRYPTO_SHA512_OPENSSL)
#define ARCHIVE_CRYPTO_OPENSSL 1
#include "archive_openssl_evp_private.h"
#endif
/* Windows crypto headers */
#if defined(ARCHIVE_CRYPTO_MD5_WIN) ||\
defined(ARCHIVE_CRYPTO_SHA1_WIN) ||\
defined(ARCHIVE_CRYPTO_SHA256_WIN) ||\
defined(ARCHIVE_CRYPTO_SHA384_WIN) ||\
defined(ARCHIVE_CRYPTO_SHA512_WIN)
#include <windows.h>
#include <wincrypt.h>
typedef struct {
int valid;
HCRYPTPROV cryptProv;
HCRYPTHASH hash;
} Digest_CTX;
#endif
/* typedefs */
#if defined(ARCHIVE_CRYPTO_MD5_LIBC)
typedef MD5_CTX archive_md5_ctx;
#elif defined(ARCHIVE_CRYPTO_MD5_LIBMD)
typedef MD5_CTX archive_md5_ctx;
#elif defined(ARCHIVE_CRYPTO_MD5_LIBSYSTEM)
typedef CC_MD5_CTX archive_md5_ctx;
#elif defined(ARCHIVE_CRYPTO_MD5_MBEDTLS)
typedef mbedtls_md5_context archive_md5_ctx;
#elif defined(ARCHIVE_CRYPTO_MD5_NETTLE)
typedef struct md5_ctx archive_md5_ctx;
#elif defined(ARCHIVE_CRYPTO_MD5_OPENSSL)
typedef EVP_MD_CTX *archive_md5_ctx;
#elif defined(ARCHIVE_CRYPTO_MD5_WIN)
typedef Digest_CTX archive_md5_ctx;
#else
typedef unsigned char archive_md5_ctx;
#endif
#if defined(ARCHIVE_CRYPTO_RMD160_LIBC)
typedef RMD160_CTX archive_rmd160_ctx;
#elif defined(ARCHIVE_CRYPTO_RMD160_LIBMD)
typedef RIPEMD160_CTX archive_rmd160_ctx;
#elif defined(ARCHIVE_CRYPTO_RMD160_MBEDTLS)
typedef mbedtls_ripemd160_context archive_rmd160_ctx;
#elif defined(ARCHIVE_CRYPTO_RMD160_NETTLE)
typedef struct ripemd160_ctx archive_rmd160_ctx;
#elif defined(ARCHIVE_CRYPTO_RMD160_OPENSSL)
typedef EVP_MD_CTX *archive_rmd160_ctx;
#else
typedef unsigned char archive_rmd160_ctx;
#endif
#if defined(ARCHIVE_CRYPTO_SHA1_LIBC)
typedef SHA1_CTX archive_sha1_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA1_LIBMD)
typedef SHA1_CTX archive_sha1_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA1_LIBSYSTEM)
typedef CC_SHA1_CTX archive_sha1_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA1_MBEDTLS)
typedef mbedtls_sha1_context archive_sha1_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA1_NETTLE)
typedef struct sha1_ctx archive_sha1_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA1_OPENSSL)
typedef EVP_MD_CTX *archive_sha1_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA1_WIN)
typedef Digest_CTX archive_sha1_ctx;
#else
typedef unsigned char archive_sha1_ctx;
#endif
#if defined(ARCHIVE_CRYPTO_SHA256_LIBC)
typedef SHA256_CTX archive_sha256_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA256_LIBC2)
typedef SHA256_CTX archive_sha256_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA256_LIBC3)
typedef SHA2_CTX archive_sha256_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA256_LIBMD)
typedef SHA256_CTX archive_sha256_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA256_LIBSYSTEM)
typedef CC_SHA256_CTX archive_sha256_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA256_MBEDTLS)
typedef mbedtls_sha256_context archive_sha256_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA256_NETTLE)
typedef struct sha256_ctx archive_sha256_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA256_OPENSSL)
typedef EVP_MD_CTX *archive_sha256_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA256_WIN)
typedef Digest_CTX archive_sha256_ctx;
#else
typedef unsigned char archive_sha256_ctx;
#endif
#if defined(ARCHIVE_CRYPTO_SHA384_LIBC)
typedef SHA384_CTX archive_sha384_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA384_LIBC2)
typedef SHA384_CTX archive_sha384_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA384_LIBC3)
typedef SHA2_CTX archive_sha384_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA384_LIBSYSTEM)
typedef CC_SHA512_CTX archive_sha384_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA384_MBEDTLS)
typedef mbedtls_sha512_context archive_sha384_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA384_NETTLE)
typedef struct sha384_ctx archive_sha384_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA384_OPENSSL)
typedef EVP_MD_CTX *archive_sha384_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA384_WIN)
typedef Digest_CTX archive_sha384_ctx;
#else
typedef unsigned char archive_sha384_ctx;
#endif
#if defined(ARCHIVE_CRYPTO_SHA512_LIBC)
typedef SHA512_CTX archive_sha512_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA512_LIBC2)
typedef SHA512_CTX archive_sha512_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA512_LIBC3)
typedef SHA2_CTX archive_sha512_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA512_LIBMD)
typedef SHA512_CTX archive_sha512_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA512_LIBSYSTEM)
typedef CC_SHA512_CTX archive_sha512_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA512_MBEDTLS)
typedef mbedtls_sha512_context archive_sha512_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA512_NETTLE)
typedef struct sha512_ctx archive_sha512_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA512_OPENSSL)
typedef EVP_MD_CTX *archive_sha512_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA512_WIN)
typedef Digest_CTX archive_sha512_ctx;
#else
typedef unsigned char archive_sha512_ctx;
#endif
/* defines */
#if defined(ARCHIVE_CRYPTO_MD5_LIBC) ||\
defined(ARCHIVE_CRYPTO_MD5_LIBMD) || \
defined(ARCHIVE_CRYPTO_MD5_LIBSYSTEM) ||\
defined(ARCHIVE_CRYPTO_MD5_MBEDTLS) ||\
defined(ARCHIVE_CRYPTO_MD5_NETTLE) ||\
defined(ARCHIVE_CRYPTO_MD5_OPENSSL) ||\
defined(ARCHIVE_CRYPTO_MD5_WIN)
#define ARCHIVE_HAS_MD5
#endif
#define archive_md5_init(ctx)\
__archive_digest.md5init(ctx)
#define archive_md5_final(ctx, md)\
__archive_digest.md5final(ctx, md)
#define archive_md5_update(ctx, buf, n)\
__archive_digest.md5update(ctx, buf, n)
#if defined(ARCHIVE_CRYPTO_RMD160_LIBC) ||\
defined(ARCHIVE_CRYPTO_RMD160_MBEDTLS) ||\
defined(ARCHIVE_CRYPTO_RMD160_NETTLE) ||\
defined(ARCHIVE_CRYPTO_RMD160_OPENSSL)
#define ARCHIVE_HAS_RMD160
#endif
#define archive_rmd160_init(ctx)\
__archive_digest.rmd160init(ctx)
#define archive_rmd160_final(ctx, md)\
__archive_digest.rmd160final(ctx, md)
#define archive_rmd160_update(ctx, buf, n)\
__archive_digest.rmd160update(ctx, buf, n)
#if defined(ARCHIVE_CRYPTO_SHA1_LIBC) ||\
defined(ARCHIVE_CRYPTO_SHA1_LIBMD) || \
defined(ARCHIVE_CRYPTO_SHA1_LIBSYSTEM) ||\
defined(ARCHIVE_CRYPTO_SHA1_MBEDTLS) ||\
defined(ARCHIVE_CRYPTO_SHA1_NETTLE) ||\
defined(ARCHIVE_CRYPTO_SHA1_OPENSSL) ||\
defined(ARCHIVE_CRYPTO_SHA1_WIN)
#define ARCHIVE_HAS_SHA1
#endif
#define archive_sha1_init(ctx)\
__archive_digest.sha1init(ctx)
#define archive_sha1_final(ctx, md)\
__archive_digest.sha1final(ctx, md)
#define archive_sha1_update(ctx, buf, n)\
__archive_digest.sha1update(ctx, buf, n)
#if defined(ARCHIVE_CRYPTO_SHA256_LIBC) ||\
defined(ARCHIVE_CRYPTO_SHA256_LIBC2) ||\
defined(ARCHIVE_CRYPTO_SHA256_LIBC3) ||\
defined(ARCHIVE_CRYPTO_SHA256_LIBMD) ||\
defined(ARCHIVE_CRYPTO_SHA256_LIBSYSTEM) ||\
defined(ARCHIVE_CRYPTO_SHA256_MBEDTLS) ||\
defined(ARCHIVE_CRYPTO_SHA256_NETTLE) ||\
defined(ARCHIVE_CRYPTO_SHA256_OPENSSL) ||\
defined(ARCHIVE_CRYPTO_SHA256_WIN)
#define ARCHIVE_HAS_SHA256
#endif
#define archive_sha256_init(ctx)\
__archive_digest.sha256init(ctx)
#define archive_sha256_final(ctx, md)\
__archive_digest.sha256final(ctx, md)
#define archive_sha256_update(ctx, buf, n)\
__archive_digest.sha256update(ctx, buf, n)
#if defined(ARCHIVE_CRYPTO_SHA384_LIBC) ||\
defined(ARCHIVE_CRYPTO_SHA384_LIBC2) ||\
defined(ARCHIVE_CRYPTO_SHA384_LIBC3) ||\
defined(ARCHIVE_CRYPTO_SHA384_LIBSYSTEM) ||\
defined(ARCHIVE_CRYPTO_SHA384_MBEDTLS) ||\
defined(ARCHIVE_CRYPTO_SHA384_NETTLE) ||\
defined(ARCHIVE_CRYPTO_SHA384_OPENSSL) ||\
defined(ARCHIVE_CRYPTO_SHA384_WIN)
#define ARCHIVE_HAS_SHA384
#endif
#define archive_sha384_init(ctx)\
__archive_digest.sha384init(ctx)
#define archive_sha384_final(ctx, md)\
__archive_digest.sha384final(ctx, md)
#define archive_sha384_update(ctx, buf, n)\
__archive_digest.sha384update(ctx, buf, n)
#if defined(ARCHIVE_CRYPTO_SHA512_LIBC) ||\
defined(ARCHIVE_CRYPTO_SHA512_LIBC2) ||\
defined(ARCHIVE_CRYPTO_SHA512_LIBC3) ||\
defined(ARCHIVE_CRYPTO_SHA512_LIBMD) ||\
defined(ARCHIVE_CRYPTO_SHA512_LIBSYSTEM) ||\
defined(ARCHIVE_CRYPTO_SHA512_MBEDTLS) ||\
defined(ARCHIVE_CRYPTO_SHA512_NETTLE) ||\
defined(ARCHIVE_CRYPTO_SHA512_OPENSSL) ||\
defined(ARCHIVE_CRYPTO_SHA512_WIN)
#define ARCHIVE_HAS_SHA512
#endif
#define archive_sha512_init(ctx)\
__archive_digest.sha512init(ctx)
#define archive_sha512_final(ctx, md)\
__archive_digest.sha512final(ctx, md)
#define archive_sha512_update(ctx, buf, n)\
__archive_digest.sha512update(ctx, buf, n)
/* Minimal interface to digest functionality for internal use in libarchive */
struct archive_digest
{
/* Message Digest */
int (*md5init)(archive_md5_ctx *ctx);
int (*md5update)(archive_md5_ctx *, const void *, size_t);
int (*md5final)(archive_md5_ctx *, void *);
int (*rmd160init)(archive_rmd160_ctx *);
int (*rmd160update)(archive_rmd160_ctx *, const void *, size_t);
int (*rmd160final)(archive_rmd160_ctx *, void *);
int (*sha1init)(archive_sha1_ctx *);
int (*sha1update)(archive_sha1_ctx *, const void *, size_t);
int (*sha1final)(archive_sha1_ctx *, void *);
int (*sha256init)(archive_sha256_ctx *);
int (*sha256update)(archive_sha256_ctx *, const void *, size_t);
int (*sha256final)(archive_sha256_ctx *, void *);
int (*sha384init)(archive_sha384_ctx *);
int (*sha384update)(archive_sha384_ctx *, const void *, size_t);
int (*sha384final)(archive_sha384_ctx *, void *);
int (*sha512init)(archive_sha512_ctx *);
int (*sha512update)(archive_sha512_ctx *, const void *, size_t);
int (*sha512final)(archive_sha512_ctx *, void *);
};
extern const struct archive_digest __archive_digest;
#endif

View File

@ -1,559 +0,0 @@
/*-
* Copyright (c) 2017 Martin Matuska
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
#if ARCHIVE_ACL_DARWIN
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#if HAVE_ERRNO_H
#include <errno.h>
#endif
#if HAVE_MEMBERSHIP_H
#include <membership.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_ACL_H
#define _ACL_PRIVATE /* For debugging */
#include <sys/acl.h>
#endif
#include "archive_entry.h"
#include "archive_private.h"
#include "archive_read_disk_private.h"
#include "archive_write_disk_private.h"
typedef struct {
const int a_perm; /* Libarchive permission or flag */
const int p_perm; /* Platform permission or flag */
} acl_perm_map_t;
static const acl_perm_map_t acl_nfs4_perm_map[] = {
{ARCHIVE_ENTRY_ACL_READ_DATA, ACL_READ_DATA},
{ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACL_LIST_DIRECTORY},
{ARCHIVE_ENTRY_ACL_WRITE_DATA, ACL_WRITE_DATA},
{ARCHIVE_ENTRY_ACL_ADD_FILE, ACL_ADD_FILE},
{ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE},
{ARCHIVE_ENTRY_ACL_DELETE, ACL_DELETE},
{ARCHIVE_ENTRY_ACL_APPEND_DATA, ACL_APPEND_DATA},
{ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY, ACL_ADD_SUBDIRECTORY},
{ARCHIVE_ENTRY_ACL_DELETE_CHILD, ACL_DELETE_CHILD},
{ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, ACL_READ_ATTRIBUTES},
{ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, ACL_WRITE_ATTRIBUTES},
{ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, ACL_READ_EXTATTRIBUTES},
{ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, ACL_WRITE_EXTATTRIBUTES},
{ARCHIVE_ENTRY_ACL_READ_ACL, ACL_READ_SECURITY},
{ARCHIVE_ENTRY_ACL_WRITE_ACL, ACL_WRITE_SECURITY},
{ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACL_CHANGE_OWNER},
#if HAVE_DECL_ACL_SYNCHRONIZE
{ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACL_SYNCHRONIZE}
#endif
};
static const int acl_nfs4_perm_map_size =
(int)(sizeof(acl_nfs4_perm_map)/sizeof(acl_nfs4_perm_map[0]));
static const acl_perm_map_t acl_nfs4_flag_map[] = {
{ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACL_ENTRY_INHERITED},
{ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_FILE_INHERIT},
{ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACL_ENTRY_DIRECTORY_INHERIT},
{ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_LIMIT_INHERIT},
{ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_ONLY_INHERIT}
};
static const int acl_nfs4_flag_map_size =
(int)(sizeof(acl_nfs4_flag_map)/sizeof(acl_nfs4_flag_map[0]));
static int translate_guid(struct archive *a, acl_entry_t acl_entry,
int *ae_id, int *ae_tag, const char **ae_name)
{
void *q;
uid_t ugid;
int r, idtype;
q = acl_get_qualifier(acl_entry);
if (q == NULL)
return (1);
r = mbr_uuid_to_id((const unsigned char *)q, &ugid, &idtype);
if (r != 0) {
acl_free(q);
return (1);
}
if (idtype == ID_TYPE_UID) {
*ae_tag = ARCHIVE_ENTRY_ACL_USER;
*ae_id = ugid;
*ae_name = archive_read_disk_uname(a, *ae_id);
} else if (idtype == ID_TYPE_GID) {
*ae_tag = ARCHIVE_ENTRY_ACL_GROUP;
*ae_id = ugid;
*ae_name = archive_read_disk_gname(a, *ae_id);
} else
r = 1;
acl_free(q);
return (r);
}
static void
add_trivial_nfs4_acl(struct archive_entry *entry)
{
mode_t mode;
int i;
const int rperm = ARCHIVE_ENTRY_ACL_READ_DATA;
const int wperm = ARCHIVE_ENTRY_ACL_WRITE_DATA |
ARCHIVE_ENTRY_ACL_APPEND_DATA;
const int eperm = ARCHIVE_ENTRY_ACL_EXECUTE;
const int pubset = ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES |
ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS |
ARCHIVE_ENTRY_ACL_READ_ACL |
ARCHIVE_ENTRY_ACL_SYNCHRONIZE;
const int ownset = pubset | ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES |
ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS |
ARCHIVE_ENTRY_ACL_WRITE_ACL |
ARCHIVE_ENTRY_ACL_WRITE_OWNER;
struct {
const int type;
const int tag;
int permset;
} tacl_entry[] = {
{ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_USER_OBJ, 0},
{ARCHIVE_ENTRY_ACL_TYPE_DENY, ARCHIVE_ENTRY_ACL_USER_OBJ, 0},
{ARCHIVE_ENTRY_ACL_TYPE_DENY, ARCHIVE_ENTRY_ACL_GROUP_OBJ, 0},
{ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_USER_OBJ, ownset},
{ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_GROUP_OBJ, pubset},
{ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_EVERYONE, pubset}
};
mode = archive_entry_mode(entry);
/* Permissions for everyone@ */
if (mode & 0004)
tacl_entry[5].permset |= rperm;
if (mode & 0002)
tacl_entry[5].permset |= wperm;
if (mode & 0001)
tacl_entry[5].permset |= eperm;
/* Permissions for group@ */
if (mode & 0040)
tacl_entry[4].permset |= rperm;
else if (mode & 0004)
tacl_entry[2].permset |= rperm;
if (mode & 0020)
tacl_entry[4].permset |= wperm;
else if (mode & 0002)
tacl_entry[2].permset |= wperm;
if (mode & 0010)
tacl_entry[4].permset |= eperm;
else if (mode & 0001)
tacl_entry[2].permset |= eperm;
/* Permissions for owner@ */
if (mode & 0400) {
tacl_entry[3].permset |= rperm;
if (!(mode & 0040) && (mode & 0004))
tacl_entry[0].permset |= rperm;
} else if ((mode & 0040) || (mode & 0004))
tacl_entry[1].permset |= rperm;
if (mode & 0200) {
tacl_entry[3].permset |= wperm;
if (!(mode & 0020) && (mode & 0002))
tacl_entry[0].permset |= wperm;
} else if ((mode & 0020) || (mode & 0002))
tacl_entry[1].permset |= wperm;
if (mode & 0100) {
tacl_entry[3].permset |= eperm;
if (!(mode & 0010) && (mode & 0001))
tacl_entry[0].permset |= eperm;
} else if ((mode & 0010) || (mode & 0001))
tacl_entry[1].permset |= eperm;
for (i = 0; i < 6; i++) {
if (tacl_entry[i].permset != 0) {
archive_entry_acl_add_entry(entry,
tacl_entry[i].type, tacl_entry[i].permset,
tacl_entry[i].tag, -1, NULL);
}
}
return;
}
static int
translate_acl(struct archive_read_disk *a,
struct archive_entry *entry, acl_t acl)
{
acl_tag_t acl_tag;
acl_flagset_t acl_flagset;
acl_entry_t acl_entry;
acl_permset_t acl_permset;
int i, entry_acl_type;
int r, s, ae_id, ae_tag, ae_perm;
const char *ae_name;
s = acl_get_entry(acl, ACL_FIRST_ENTRY, &acl_entry);
if (s == -1) {
archive_set_error(&a->archive, errno,
"Failed to get first ACL entry");
return (ARCHIVE_WARN);
}
while (s == 0) {
ae_id = -1;
ae_name = NULL;
ae_perm = 0;
if (acl_get_tag_type(acl_entry, &acl_tag) != 0) {
archive_set_error(&a->archive, errno,
"Failed to get ACL tag type");
return (ARCHIVE_WARN);
}
switch (acl_tag) {
case ACL_EXTENDED_ALLOW:
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALLOW;
r = translate_guid(&a->archive, acl_entry,
&ae_id, &ae_tag, &ae_name);
break;
case ACL_EXTENDED_DENY:
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_DENY;
r = translate_guid(&a->archive, acl_entry,
&ae_id, &ae_tag, &ae_name);
break;
default:
/* Skip types that libarchive can't support. */
s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
continue;
}
/* Skip if translate_guid() above failed */
if (r != 0) {
s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
continue;
}
/*
* Libarchive stores "flag" (NFSv4 inheritance bits)
* in the ae_perm bitmap.
*
* acl_get_flagset_np() fails with non-NFSv4 ACLs
*/
if (acl_get_flagset_np(acl_entry, &acl_flagset) != 0) {
archive_set_error(&a->archive, errno,
"Failed to get flagset from a NFSv4 ACL entry");
return (ARCHIVE_WARN);
}
for (i = 0; i < acl_nfs4_flag_map_size; ++i) {
r = acl_get_flag_np(acl_flagset,
acl_nfs4_flag_map[i].p_perm);
if (r == -1) {
archive_set_error(&a->archive, errno,
"Failed to check flag in a NFSv4 "
"ACL flagset");
return (ARCHIVE_WARN);
} else if (r)
ae_perm |= acl_nfs4_flag_map[i].a_perm;
}
if (acl_get_permset(acl_entry, &acl_permset) != 0) {
archive_set_error(&a->archive, errno,
"Failed to get ACL permission set");
return (ARCHIVE_WARN);
}
for (i = 0; i < acl_nfs4_perm_map_size; ++i) {
/*
* acl_get_perm() is spelled differently on different
* platforms; see above.
*/
r = acl_get_perm_np(acl_permset,
acl_nfs4_perm_map[i].p_perm);
if (r == -1) {
archive_set_error(&a->archive, errno,
"Failed to check permission in an ACL "
"permission set");
return (ARCHIVE_WARN);
} else if (r)
ae_perm |= acl_nfs4_perm_map[i].a_perm;
}
#if !HAVE_DECL_ACL_SYNCHRONIZE
/* On Mac OS X without ACL_SYNCHRONIZE assume it is set */
ae_perm |= ARCHIVE_ENTRY_ACL_SYNCHRONIZE;
#endif
archive_entry_acl_add_entry(entry, entry_acl_type,
ae_perm, ae_tag,
ae_id, ae_name);
s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
}
return (ARCHIVE_OK);
}
static int
set_acl(struct archive *a, int fd, const char *name,
struct archive_acl *abstract_acl,
int ae_requested_type, const char *tname)
{
acl_t acl;
acl_entry_t acl_entry;
acl_permset_t acl_permset;
acl_flagset_t acl_flagset;
int ret;
int ae_type, ae_permset, ae_tag, ae_id;
uuid_t ae_uuid;
uid_t ae_uid;
gid_t ae_gid;
const char *ae_name;
int entries;
int i;
ret = ARCHIVE_OK;
entries = archive_acl_reset(abstract_acl, ae_requested_type);
if (entries == 0)
return (ARCHIVE_OK);
if (ae_requested_type != ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
errno = ENOENT;
archive_set_error(a, errno, "Unsupported ACL type");
return (ARCHIVE_FAILED);
}
acl = acl_init(entries);
if (acl == (acl_t)NULL) {
archive_set_error(a, errno,
"Failed to initialize ACL working storage");
return (ARCHIVE_FAILED);
}
while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type,
&ae_permset, &ae_tag, &ae_id, &ae_name) == ARCHIVE_OK) {
/*
* Mac OS doesn't support NFSv4 ACLs for
* owner@, group@ and everyone@.
* We skip any of these ACLs found.
*/
if (ae_tag == ARCHIVE_ENTRY_ACL_USER_OBJ ||
ae_tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ ||
ae_tag == ARCHIVE_ENTRY_ACL_EVERYONE)
continue;
if (acl_create_entry(&acl, &acl_entry) != 0) {
archive_set_error(a, errno,
"Failed to create a new ACL entry");
ret = ARCHIVE_FAILED;
goto exit_free;
}
switch (ae_type) {
case ARCHIVE_ENTRY_ACL_TYPE_ALLOW:
acl_set_tag_type(acl_entry, ACL_EXTENDED_ALLOW);
break;
case ARCHIVE_ENTRY_ACL_TYPE_DENY:
acl_set_tag_type(acl_entry, ACL_EXTENDED_DENY);
break;
default:
/* We don't support any other types on MacOS */
continue;
}
switch (ae_tag) {
case ARCHIVE_ENTRY_ACL_USER:
ae_uid = archive_write_disk_uid(a, ae_name, ae_id);
if (mbr_uid_to_uuid(ae_uid, ae_uuid) != 0)
continue;
if (acl_set_qualifier(acl_entry, &ae_uuid) != 0)
continue;
break;
case ARCHIVE_ENTRY_ACL_GROUP:
ae_gid = archive_write_disk_gid(a, ae_name, ae_id);
if (mbr_gid_to_uuid(ae_gid, ae_uuid) != 0)
continue;
if (acl_set_qualifier(acl_entry, &ae_uuid) != 0)
continue;
break;
default:
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Unsupported ACL tag");
ret = ARCHIVE_FAILED;
goto exit_free;
}
if (acl_get_permset(acl_entry, &acl_permset) != 0) {
archive_set_error(a, errno,
"Failed to get ACL permission set");
ret = ARCHIVE_FAILED;
goto exit_free;
}
if (acl_clear_perms(acl_permset) != 0) {
archive_set_error(a, errno,
"Failed to clear ACL permissions");
ret = ARCHIVE_FAILED;
goto exit_free;
}
for (i = 0; i < acl_nfs4_perm_map_size; ++i) {
if (ae_permset & acl_nfs4_perm_map[i].a_perm) {
if (acl_add_perm(acl_permset,
acl_nfs4_perm_map[i].p_perm) != 0) {
archive_set_error(a, errno,
"Failed to add ACL permission");
ret = ARCHIVE_FAILED;
goto exit_free;
}
}
}
/*
* acl_get_flagset_np() fails with non-NFSv4 ACLs
*/
if (acl_get_flagset_np(acl_entry, &acl_flagset) != 0) {
archive_set_error(a, errno,
"Failed to get flagset from an NFSv4 ACL entry");
ret = ARCHIVE_FAILED;
goto exit_free;
}
if (acl_clear_flags_np(acl_flagset) != 0) {
archive_set_error(a, errno,
"Failed to clear flags from an NFSv4 ACL flagset");
ret = ARCHIVE_FAILED;
goto exit_free;
}
for (i = 0; i < acl_nfs4_flag_map_size; ++i) {
if (ae_permset & acl_nfs4_flag_map[i].a_perm) {
if (acl_add_flag_np(acl_flagset,
acl_nfs4_flag_map[i].p_perm) != 0) {
archive_set_error(a, errno,
"Failed to add flag to "
"NFSv4 ACL flagset");
ret = ARCHIVE_FAILED;
goto exit_free;
}
}
}
}
if (fd >= 0) {
if (acl_set_fd_np(fd, acl, ACL_TYPE_EXTENDED) == 0)
ret = ARCHIVE_OK;
else {
if (errno == EOPNOTSUPP) {
/* Filesystem doesn't support ACLs */
ret = ARCHIVE_OK;
} else {
archive_set_error(a, errno,
"Failed to set acl on fd: %s", tname);
ret = ARCHIVE_WARN;
}
}
} else if (acl_set_link_np(name, ACL_TYPE_EXTENDED, acl) != 0) {
if (errno == EOPNOTSUPP) {
/* Filesystem doesn't support ACLs */
ret = ARCHIVE_OK;
} else {
archive_set_error(a, errno, "Failed to set acl: %s",
tname);
ret = ARCHIVE_WARN;
}
}
exit_free:
acl_free(acl);
return (ret);
}
int
archive_read_disk_entry_setup_acls(struct archive_read_disk *a,
struct archive_entry *entry, int *fd)
{
const char *accpath;
acl_t acl;
int r;
accpath = NULL;
if (*fd < 0) {
accpath = archive_read_disk_entry_setup_path(a, entry, fd);
if (accpath == NULL)
return (ARCHIVE_WARN);
}
archive_entry_acl_clear(entry);
acl = NULL;
if (*fd >= 0)
acl = acl_get_fd_np(*fd, ACL_TYPE_EXTENDED);
else if (!a->follow_symlinks)
acl = acl_get_link_np(accpath, ACL_TYPE_EXTENDED);
else
acl = acl_get_file(accpath, ACL_TYPE_EXTENDED);
if (acl != NULL) {
r = translate_acl(a, entry, acl);
acl_free(acl);
acl = NULL;
if (r != ARCHIVE_OK) {
archive_set_error(&a->archive, errno,
"Couldn't translate NFSv4 ACLs");
}
/*
* Because Mac OS doesn't support owner@, group@ and everyone@
* ACLs we need to add NFSv4 ACLs mirroring the file mode to
* the archive entry. Otherwise extraction on non-Mac platforms
* would lead to an invalid file mode.
*/
if ((archive_entry_acl_types(entry) &
ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0)
add_trivial_nfs4_acl(entry);
return (r);
}
return (ARCHIVE_OK);
}
int
archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
struct archive_acl *abstract_acl, __LA_MODE_T mode)
{
int ret = ARCHIVE_OK;
(void)mode; /* UNUSED */
if ((archive_acl_types(abstract_acl) &
ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
ret = set_acl(a, fd, name, abstract_acl,
ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4");
}
return (ret);
}
#endif /* ARCHIVE_ACL_DARWIN */

View File

@ -1,702 +0,0 @@
/*-
* Copyright (c) 2003-2009 Tim Kientzle
* Copyright (c) 2010-2012 Michihiro NAKAJIMA
* Copyright (c) 2017 Martin Matuska
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
#if ARCHIVE_ACL_FREEBSD
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_ACL_H
#define _ACL_PRIVATE /* For debugging */
#include <sys/acl.h>
#endif
#include "archive_entry.h"
#include "archive_private.h"
#include "archive_read_disk_private.h"
#include "archive_write_disk_private.h"
typedef struct {
const int a_perm; /* Libarchive permission or flag */
const int p_perm; /* Platform permission or flag */
} acl_perm_map_t;
static const acl_perm_map_t acl_posix_perm_map[] = {
{ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE},
{ARCHIVE_ENTRY_ACL_WRITE, ACL_WRITE},
{ARCHIVE_ENTRY_ACL_READ, ACL_READ},
};
static const int acl_posix_perm_map_size =
(int)(sizeof(acl_posix_perm_map)/sizeof(acl_posix_perm_map[0]));
#if ARCHIVE_ACL_FREEBSD_NFS4
static const acl_perm_map_t acl_nfs4_perm_map[] = {
{ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE},
{ARCHIVE_ENTRY_ACL_READ_DATA, ACL_READ_DATA},
{ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACL_LIST_DIRECTORY},
{ARCHIVE_ENTRY_ACL_WRITE_DATA, ACL_WRITE_DATA},
{ARCHIVE_ENTRY_ACL_ADD_FILE, ACL_ADD_FILE},
{ARCHIVE_ENTRY_ACL_APPEND_DATA, ACL_APPEND_DATA},
{ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY, ACL_ADD_SUBDIRECTORY},
{ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, ACL_READ_NAMED_ATTRS},
{ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, ACL_WRITE_NAMED_ATTRS},
{ARCHIVE_ENTRY_ACL_DELETE_CHILD, ACL_DELETE_CHILD},
{ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, ACL_READ_ATTRIBUTES},
{ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, ACL_WRITE_ATTRIBUTES},
{ARCHIVE_ENTRY_ACL_DELETE, ACL_DELETE},
{ARCHIVE_ENTRY_ACL_READ_ACL, ACL_READ_ACL},
{ARCHIVE_ENTRY_ACL_WRITE_ACL, ACL_WRITE_ACL},
{ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACL_WRITE_OWNER},
{ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACL_SYNCHRONIZE}
};
static const int acl_nfs4_perm_map_size =
(int)(sizeof(acl_nfs4_perm_map)/sizeof(acl_nfs4_perm_map[0]));
static const acl_perm_map_t acl_nfs4_flag_map[] = {
{ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_FILE_INHERIT},
{ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACL_ENTRY_DIRECTORY_INHERIT},
{ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_NO_PROPAGATE_INHERIT},
{ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY},
{ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, ACL_ENTRY_SUCCESSFUL_ACCESS},
{ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, ACL_ENTRY_FAILED_ACCESS},
#ifdef ACL_ENTRY_INHERITED
{ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACL_ENTRY_INHERITED}
#endif
};
static const int acl_nfs4_flag_map_size =
(int)(sizeof(acl_nfs4_flag_map)/sizeof(acl_nfs4_flag_map[0]));
#endif /* ARCHIVE_ACL_FREEBSD_NFS4 */
static int
translate_acl(struct archive_read_disk *a,
struct archive_entry *entry, acl_t acl, int default_entry_acl_type)
{
#if ARCHIVE_ACL_FREEBSD_NFS4
int brand;
acl_flagset_t acl_flagset;
acl_entry_type_t acl_type;
#endif
acl_tag_t acl_tag;
acl_entry_t acl_entry;
acl_permset_t acl_permset;
int i, entry_acl_type, perm_map_size;
const acl_perm_map_t *perm_map;
int r, s, ae_id, ae_tag, ae_perm;
void *q;
const char *ae_name;
#if ARCHIVE_ACL_FREEBSD_NFS4
// FreeBSD "brands" ACLs as POSIX.1e or NFSv4
// Make sure the "brand" on this ACL is consistent
// with the default_entry_acl_type bits provided.
if (acl_get_brand_np(acl, &brand) != 0) {
archive_set_error(&a->archive, errno,
"Failed to read ACL brand");
return (ARCHIVE_WARN);
}
switch (brand) {
case ACL_BRAND_POSIX:
switch (default_entry_acl_type) {
case ARCHIVE_ENTRY_ACL_TYPE_ACCESS:
case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
break;
default:
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Invalid ACL entry type for POSIX.1e ACL");
return (ARCHIVE_WARN);
}
break;
case ACL_BRAND_NFS4:
if (default_entry_acl_type & ~ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Invalid ACL entry type for NFSv4 ACL");
return (ARCHIVE_WARN);
}
break;
default:
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Unknown ACL brand");
return (ARCHIVE_WARN);
}
#endif
s = acl_get_entry(acl, ACL_FIRST_ENTRY, &acl_entry);
if (s == -1) {
archive_set_error(&a->archive, errno,
"Failed to get first ACL entry");
return (ARCHIVE_WARN);
}
while (s == 1) {
ae_id = -1;
ae_name = NULL;
ae_perm = 0;
if (acl_get_tag_type(acl_entry, &acl_tag) != 0) {
archive_set_error(&a->archive, errno,
"Failed to get ACL tag type");
return (ARCHIVE_WARN);
}
switch (acl_tag) {
case ACL_USER:
q = acl_get_qualifier(acl_entry);
if (q != NULL) {
ae_id = (int)*(uid_t *)q;
acl_free(q);
ae_name = archive_read_disk_uname(&a->archive,
ae_id);
}
ae_tag = ARCHIVE_ENTRY_ACL_USER;
break;
case ACL_GROUP:
q = acl_get_qualifier(acl_entry);
if (q != NULL) {
ae_id = (int)*(gid_t *)q;
acl_free(q);
ae_name = archive_read_disk_gname(&a->archive,
ae_id);
}
ae_tag = ARCHIVE_ENTRY_ACL_GROUP;
break;
case ACL_MASK:
ae_tag = ARCHIVE_ENTRY_ACL_MASK;
break;
case ACL_USER_OBJ:
ae_tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
break;
case ACL_GROUP_OBJ:
ae_tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
break;
case ACL_OTHER:
ae_tag = ARCHIVE_ENTRY_ACL_OTHER;
break;
#if ARCHIVE_ACL_FREEBSD_NFS4
case ACL_EVERYONE:
ae_tag = ARCHIVE_ENTRY_ACL_EVERYONE;
break;
#endif
default:
/* Skip types that libarchive can't support. */
s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
continue;
}
// XXX acl_type maps to allow/deny/audit/YYYY bits
entry_acl_type = default_entry_acl_type;
#if ARCHIVE_ACL_FREEBSD_NFS4
if (default_entry_acl_type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
/*
* acl_get_entry_type_np() fails with non-NFSv4 ACLs
*/
if (acl_get_entry_type_np(acl_entry, &acl_type) != 0) {
archive_set_error(&a->archive, errno, "Failed "
"to get ACL type from a NFSv4 ACL entry");
return (ARCHIVE_WARN);
}
switch (acl_type) {
case ACL_ENTRY_TYPE_ALLOW:
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALLOW;
break;
case ACL_ENTRY_TYPE_DENY:
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_DENY;
break;
case ACL_ENTRY_TYPE_AUDIT:
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_AUDIT;
break;
case ACL_ENTRY_TYPE_ALARM:
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALARM;
break;
default:
archive_set_error(&a->archive, errno,
"Invalid NFSv4 ACL entry type");
return (ARCHIVE_WARN);
}
/*
* Libarchive stores "flag" (NFSv4 inheritance bits)
* in the ae_perm bitmap.
*
* acl_get_flagset_np() fails with non-NFSv4 ACLs
*/
if (acl_get_flagset_np(acl_entry, &acl_flagset) != 0) {
archive_set_error(&a->archive, errno,
"Failed to get flagset from a NFSv4 "
"ACL entry");
return (ARCHIVE_WARN);
}
for (i = 0; i < acl_nfs4_flag_map_size; ++i) {
r = acl_get_flag_np(acl_flagset,
acl_nfs4_flag_map[i].p_perm);
if (r == -1) {
archive_set_error(&a->archive, errno,
"Failed to check flag in a NFSv4 "
"ACL flagset");
return (ARCHIVE_WARN);
} else if (r)
ae_perm |= acl_nfs4_flag_map[i].a_perm;
}
}
#endif
if (acl_get_permset(acl_entry, &acl_permset) != 0) {
archive_set_error(&a->archive, errno,
"Failed to get ACL permission set");
return (ARCHIVE_WARN);
}
#if ARCHIVE_ACL_FREEBSD_NFS4
if (default_entry_acl_type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
perm_map_size = acl_nfs4_perm_map_size;
perm_map = acl_nfs4_perm_map;
} else {
#endif
perm_map_size = acl_posix_perm_map_size;
perm_map = acl_posix_perm_map;
#if ARCHIVE_ACL_FREEBSD_NFS4
}
#endif
for (i = 0; i < perm_map_size; ++i) {
r = acl_get_perm_np(acl_permset, perm_map[i].p_perm);
if (r == -1) {
archive_set_error(&a->archive, errno,
"Failed to check permission in an ACL "
"permission set");
return (ARCHIVE_WARN);
} else if (r)
ae_perm |= perm_map[i].a_perm;
}
archive_entry_acl_add_entry(entry, entry_acl_type,
ae_perm, ae_tag,
ae_id, ae_name);
s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
if (s == -1) {
archive_set_error(&a->archive, errno,
"Failed to get next ACL entry");
return (ARCHIVE_WARN);
}
}
return (ARCHIVE_OK);
}
static int
set_acl(struct archive *a, int fd, const char *name,
struct archive_acl *abstract_acl,
int ae_requested_type, const char *tname)
{
int acl_type = 0;
acl_t acl;
acl_entry_t acl_entry;
acl_permset_t acl_permset;
#if ARCHIVE_ACL_FREEBSD_NFS4
acl_flagset_t acl_flagset;
int r;
#endif
int ret;
int ae_type, ae_permset, ae_tag, ae_id;
int perm_map_size;
const acl_perm_map_t *perm_map;
uid_t ae_uid;
gid_t ae_gid;
const char *ae_name;
int entries;
int i;
ret = ARCHIVE_OK;
entries = archive_acl_reset(abstract_acl, ae_requested_type);
if (entries == 0)
return (ARCHIVE_OK);
switch (ae_requested_type) {
case ARCHIVE_ENTRY_ACL_TYPE_ACCESS:
acl_type = ACL_TYPE_ACCESS;
break;
case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
acl_type = ACL_TYPE_DEFAULT;
break;
#if ARCHIVE_ACL_FREEBSD_NFS4
case ARCHIVE_ENTRY_ACL_TYPE_NFS4:
acl_type = ACL_TYPE_NFS4;
break;
#endif
default:
errno = ENOENT;
archive_set_error(a, errno, "Unsupported ACL type");
return (ARCHIVE_FAILED);
}
acl = acl_init(entries);
if (acl == (acl_t)NULL) {
archive_set_error(a, errno,
"Failed to initialize ACL working storage");
return (ARCHIVE_FAILED);
}
while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type,
&ae_permset, &ae_tag, &ae_id, &ae_name) == ARCHIVE_OK) {
if (acl_create_entry(&acl, &acl_entry) != 0) {
archive_set_error(a, errno,
"Failed to create a new ACL entry");
ret = ARCHIVE_FAILED;
goto exit_free;
}
switch (ae_tag) {
case ARCHIVE_ENTRY_ACL_USER:
ae_uid = archive_write_disk_uid(a, ae_name, ae_id);
acl_set_tag_type(acl_entry, ACL_USER);
acl_set_qualifier(acl_entry, &ae_uid);
break;
case ARCHIVE_ENTRY_ACL_GROUP:
ae_gid = archive_write_disk_gid(a, ae_name, ae_id);
acl_set_tag_type(acl_entry, ACL_GROUP);
acl_set_qualifier(acl_entry, &ae_gid);
break;
case ARCHIVE_ENTRY_ACL_USER_OBJ:
acl_set_tag_type(acl_entry, ACL_USER_OBJ);
break;
case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
acl_set_tag_type(acl_entry, ACL_GROUP_OBJ);
break;
case ARCHIVE_ENTRY_ACL_MASK:
acl_set_tag_type(acl_entry, ACL_MASK);
break;
case ARCHIVE_ENTRY_ACL_OTHER:
acl_set_tag_type(acl_entry, ACL_OTHER);
break;
#if ARCHIVE_ACL_FREEBSD_NFS4
case ARCHIVE_ENTRY_ACL_EVERYONE:
acl_set_tag_type(acl_entry, ACL_EVERYONE);
break;
#endif
default:
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Unsupported ACL tag");
ret = ARCHIVE_FAILED;
goto exit_free;
}
#if ARCHIVE_ACL_FREEBSD_NFS4
r = 0;
switch (ae_type) {
case ARCHIVE_ENTRY_ACL_TYPE_ALLOW:
r = acl_set_entry_type_np(acl_entry,
ACL_ENTRY_TYPE_ALLOW);
break;
case ARCHIVE_ENTRY_ACL_TYPE_DENY:
r = acl_set_entry_type_np(acl_entry,
ACL_ENTRY_TYPE_DENY);
break;
case ARCHIVE_ENTRY_ACL_TYPE_AUDIT:
r = acl_set_entry_type_np(acl_entry,
ACL_ENTRY_TYPE_AUDIT);
break;
case ARCHIVE_ENTRY_ACL_TYPE_ALARM:
r = acl_set_entry_type_np(acl_entry,
ACL_ENTRY_TYPE_ALARM);
break;
case ARCHIVE_ENTRY_ACL_TYPE_ACCESS:
case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
// These don't translate directly into the system ACL.
break;
default:
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Unsupported ACL entry type");
ret = ARCHIVE_FAILED;
goto exit_free;
}
if (r != 0) {
archive_set_error(a, errno,
"Failed to set ACL entry type");
ret = ARCHIVE_FAILED;
goto exit_free;
}
#endif
if (acl_get_permset(acl_entry, &acl_permset) != 0) {
archive_set_error(a, errno,
"Failed to get ACL permission set");
ret = ARCHIVE_FAILED;
goto exit_free;
}
if (acl_clear_perms(acl_permset) != 0) {
archive_set_error(a, errno,
"Failed to clear ACL permissions");
ret = ARCHIVE_FAILED;
goto exit_free;
}
#if ARCHIVE_ACL_FREEBSD_NFS4
if (ae_requested_type == ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
perm_map_size = acl_nfs4_perm_map_size;
perm_map = acl_nfs4_perm_map;
} else {
#endif
perm_map_size = acl_posix_perm_map_size;
perm_map = acl_posix_perm_map;
#if ARCHIVE_ACL_FREEBSD_NFS4
}
#endif
for (i = 0; i < perm_map_size; ++i) {
if (ae_permset & perm_map[i].a_perm) {
if (acl_add_perm(acl_permset,
perm_map[i].p_perm) != 0) {
archive_set_error(a, errno,
"Failed to add ACL permission");
ret = ARCHIVE_FAILED;
goto exit_free;
}
}
}
#if ARCHIVE_ACL_FREEBSD_NFS4
if (ae_requested_type == ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
/*
* acl_get_flagset_np() fails with non-NFSv4 ACLs
*/
if (acl_get_flagset_np(acl_entry, &acl_flagset) != 0) {
archive_set_error(a, errno,
"Failed to get flagset from an NFSv4 "
"ACL entry");
ret = ARCHIVE_FAILED;
goto exit_free;
}
if (acl_clear_flags_np(acl_flagset) != 0) {
archive_set_error(a, errno,
"Failed to clear flags from an NFSv4 "
"ACL flagset");
ret = ARCHIVE_FAILED;
goto exit_free;
}
for (i = 0; i < acl_nfs4_flag_map_size; ++i) {
if (ae_permset & acl_nfs4_flag_map[i].a_perm) {
if (acl_add_flag_np(acl_flagset,
acl_nfs4_flag_map[i].p_perm) != 0) {
archive_set_error(a, errno,
"Failed to add flag to "
"NFSv4 ACL flagset");
ret = ARCHIVE_FAILED;
goto exit_free;
}
}
}
}
#endif
}
/* Try restoring the ACL through 'fd' if we can. */
if (fd >= 0) {
if (acl_set_fd_np(fd, acl, acl_type) == 0)
ret = ARCHIVE_OK;
else {
if (errno == EOPNOTSUPP) {
/* Filesystem doesn't support ACLs */
ret = ARCHIVE_OK;
} else {
archive_set_error(a, errno,
"Failed to set acl on fd: %s", tname);
ret = ARCHIVE_WARN;
}
}
}
#if HAVE_ACL_SET_LINK_NP
else if (acl_set_link_np(name, acl_type, acl) != 0)
#else
/* FreeBSD older than 8.0 */
else if (acl_set_file(name, acl_type, acl) != 0)
#endif
{
if (errno == EOPNOTSUPP) {
/* Filesystem doesn't support ACLs */
ret = ARCHIVE_OK;
} else {
archive_set_error(a, errno, "Failed to set acl: %s",
tname);
ret = ARCHIVE_WARN;
}
}
exit_free:
acl_free(acl);
return (ret);
}
int
archive_read_disk_entry_setup_acls(struct archive_read_disk *a,
struct archive_entry *entry, int *fd)
{
const char *accpath;
acl_t acl;
int r;
accpath = NULL;
if (*fd < 0) {
accpath = archive_read_disk_entry_setup_path(a, entry, fd);
if (accpath == NULL)
return (ARCHIVE_WARN);
}
archive_entry_acl_clear(entry);
acl = NULL;
#if ARCHIVE_ACL_FREEBSD_NFS4
/* Try NFSv4 ACL first. */
if (*fd >= 0)
acl = acl_get_fd_np(*fd, ACL_TYPE_NFS4);
else if (!a->follow_symlinks)
acl = acl_get_link_np(accpath, ACL_TYPE_NFS4);
else
acl = acl_get_file(accpath, ACL_TYPE_NFS4);
/* Ignore "trivial" ACLs that just mirror the file mode. */
if (acl != NULL && acl_is_trivial_np(acl, &r) == 0 && r == 1) {
acl_free(acl);
acl = NULL;
return (ARCHIVE_OK);
}
if (acl != NULL) {
r = translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4);
acl_free(acl);
acl = NULL;
if (r != ARCHIVE_OK) {
archive_set_error(&a->archive, errno,
"Couldn't translate NFSv4 ACLs");
}
return (r);
}
#endif
/* Retrieve access ACL from file. */
if (*fd >= 0)
acl = acl_get_fd_np(*fd, ACL_TYPE_ACCESS);
#if HAVE_ACL_GET_LINK_NP
else if (!a->follow_symlinks)
acl = acl_get_link_np(accpath, ACL_TYPE_ACCESS);
#else
else if ((!a->follow_symlinks)
&& (archive_entry_filetype(entry) == AE_IFLNK))
/* We can't get the ACL of a symlink, so we assume it can't
have one. */
acl = NULL;
#endif
else
acl = acl_get_file(accpath, ACL_TYPE_ACCESS);
#if HAVE_ACL_IS_TRIVIAL_NP
/* Ignore "trivial" ACLs that just mirror the file mode. */
if (acl != NULL && acl_is_trivial_np(acl, &r) == 0 && r == 1) {
acl_free(acl);
acl = NULL;
}
#endif
if (acl != NULL) {
r = translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
acl_free(acl);
acl = NULL;
if (r != ARCHIVE_OK) {
archive_set_error(&a->archive, errno,
"Couldn't translate access ACLs");
return (r);
}
}
/* Only directories can have default ACLs. */
if (S_ISDIR(archive_entry_mode(entry))) {
if (*fd >= 0)
acl = acl_get_fd_np(*fd, ACL_TYPE_DEFAULT);
else
acl = acl_get_file(accpath, ACL_TYPE_DEFAULT);
if (acl != NULL) {
r = translate_acl(a, entry, acl,
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
acl_free(acl);
if (r != ARCHIVE_OK) {
archive_set_error(&a->archive, errno,
"Couldn't translate default ACLs");
return (r);
}
}
}
return (ARCHIVE_OK);
}
int
archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
struct archive_acl *abstract_acl, __LA_MODE_T mode)
{
int ret = ARCHIVE_OK;
(void)mode; /* UNUSED */
if ((archive_acl_types(abstract_acl)
& ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
if ((archive_acl_types(abstract_acl)
& ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
ret = set_acl(a, fd, name, abstract_acl,
ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access");
if (ret != ARCHIVE_OK)
return (ret);
}
if ((archive_acl_types(abstract_acl)
& ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0)
ret = set_acl(a, fd, name, abstract_acl,
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default");
/* Simultaneous POSIX.1e and NFSv4 is not supported */
return (ret);
}
#if ARCHIVE_ACL_FREEBSD_NFS4
else if ((archive_acl_types(abstract_acl) &
ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
ret = set_acl(a, fd, name, abstract_acl,
ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4");
}
#endif
return (ret);
}
#endif /* ARCHIVE_ACL_FREEBSD */

View File

@ -1,743 +0,0 @@
/*-
* Copyright (c) 2003-2009 Tim Kientzle
* Copyright (c) 2010-2012 Michihiro NAKAJIMA
* Copyright (c) 2017 Martin Matuska
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
#if ARCHIVE_ACL_LIBACL || ARCHIVE_ACL_LIBRICHACL
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#if HAVE_ACL_LIBACL_H
#include <acl/libacl.h>
#endif
#ifdef HAVE_SYS_ACL_H
#include <sys/acl.h>
#endif
#ifdef HAVE_SYS_RICHACL_H
#include <sys/richacl.h>
#endif
#include "archive_entry.h"
#include "archive_private.h"
#include "archive_read_disk_private.h"
#include "archive_write_disk_private.h"
typedef struct {
const int a_perm; /* Libarchive permission or flag */
const int p_perm; /* Platform permission or flag */
} acl_perm_map_t;
#if ARCHIVE_ACL_LIBACL
static const acl_perm_map_t acl_posix_perm_map[] = {
{ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE},
{ARCHIVE_ENTRY_ACL_WRITE, ACL_WRITE},
{ARCHIVE_ENTRY_ACL_READ, ACL_READ},
};
static const int acl_posix_perm_map_size =
(int)(sizeof(acl_posix_perm_map)/sizeof(acl_posix_perm_map[0]));
#endif /* ARCHIVE_ACL_LIBACL */
#if ARCHIVE_ACL_LIBRICHACL
static const acl_perm_map_t acl_nfs4_perm_map[] = {
{ARCHIVE_ENTRY_ACL_EXECUTE, RICHACE_EXECUTE},
{ARCHIVE_ENTRY_ACL_READ_DATA, RICHACE_READ_DATA},
{ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, RICHACE_LIST_DIRECTORY},
{ARCHIVE_ENTRY_ACL_WRITE_DATA, RICHACE_WRITE_DATA},
{ARCHIVE_ENTRY_ACL_ADD_FILE, RICHACE_ADD_FILE},
{ARCHIVE_ENTRY_ACL_APPEND_DATA, RICHACE_APPEND_DATA},
{ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY, RICHACE_ADD_SUBDIRECTORY},
{ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, RICHACE_READ_NAMED_ATTRS},
{ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, RICHACE_WRITE_NAMED_ATTRS},
{ARCHIVE_ENTRY_ACL_DELETE_CHILD, RICHACE_DELETE_CHILD},
{ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, RICHACE_READ_ATTRIBUTES},
{ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, RICHACE_WRITE_ATTRIBUTES},
{ARCHIVE_ENTRY_ACL_DELETE, RICHACE_DELETE},
{ARCHIVE_ENTRY_ACL_READ_ACL, RICHACE_READ_ACL},
{ARCHIVE_ENTRY_ACL_WRITE_ACL, RICHACE_WRITE_ACL},
{ARCHIVE_ENTRY_ACL_WRITE_OWNER, RICHACE_WRITE_OWNER},
{ARCHIVE_ENTRY_ACL_SYNCHRONIZE, RICHACE_SYNCHRONIZE}
};
static const int acl_nfs4_perm_map_size =
(int)(sizeof(acl_nfs4_perm_map)/sizeof(acl_nfs4_perm_map[0]));
static const acl_perm_map_t acl_nfs4_flag_map[] = {
{ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, RICHACE_FILE_INHERIT_ACE},
{ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, RICHACE_DIRECTORY_INHERIT_ACE},
{ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, RICHACE_NO_PROPAGATE_INHERIT_ACE},
{ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, RICHACE_INHERIT_ONLY_ACE},
{ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, RICHACE_INHERITED_ACE}
};
static const int acl_nfs4_flag_map_size =
(int)(sizeof(acl_nfs4_flag_map)/sizeof(acl_nfs4_flag_map[0]));
#endif /* ARCHIVE_ACL_LIBRICHACL */
#if ARCHIVE_ACL_LIBACL
/*
* Translate POSIX.1e ACLs into libarchive internal structure
*/
static int
translate_acl(struct archive_read_disk *a,
struct archive_entry *entry, acl_t acl, int default_entry_acl_type)
{
acl_tag_t acl_tag;
acl_entry_t acl_entry;
acl_permset_t acl_permset;
int i, entry_acl_type;
int r, s, ae_id, ae_tag, ae_perm;
void *q;
const char *ae_name;
s = acl_get_entry(acl, ACL_FIRST_ENTRY, &acl_entry);
if (s == -1) {
archive_set_error(&a->archive, errno,
"Failed to get first ACL entry");
return (ARCHIVE_WARN);
}
while (s == 1) {
ae_id = -1;
ae_name = NULL;
ae_perm = 0;
if (acl_get_tag_type(acl_entry, &acl_tag) != 0) {
archive_set_error(&a->archive, errno,
"Failed to get ACL tag type");
return (ARCHIVE_WARN);
}
switch (acl_tag) {
case ACL_USER:
q = acl_get_qualifier(acl_entry);
if (q != NULL) {
ae_id = (int)*(uid_t *)q;
acl_free(q);
ae_name = archive_read_disk_uname(&a->archive,
ae_id);
}
ae_tag = ARCHIVE_ENTRY_ACL_USER;
break;
case ACL_GROUP:
q = acl_get_qualifier(acl_entry);
if (q != NULL) {
ae_id = (int)*(gid_t *)q;
acl_free(q);
ae_name = archive_read_disk_gname(&a->archive,
ae_id);
}
ae_tag = ARCHIVE_ENTRY_ACL_GROUP;
break;
case ACL_MASK:
ae_tag = ARCHIVE_ENTRY_ACL_MASK;
break;
case ACL_USER_OBJ:
ae_tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
break;
case ACL_GROUP_OBJ:
ae_tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
break;
case ACL_OTHER:
ae_tag = ARCHIVE_ENTRY_ACL_OTHER;
break;
default:
/* Skip types that libarchive can't support. */
s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
continue;
}
// XXX acl_type maps to allow/deny/audit/YYYY bits
entry_acl_type = default_entry_acl_type;
if (acl_get_permset(acl_entry, &acl_permset) != 0) {
archive_set_error(&a->archive, errno,
"Failed to get ACL permission set");
return (ARCHIVE_WARN);
}
for (i = 0; i < acl_posix_perm_map_size; ++i) {
r = acl_get_perm(acl_permset,
acl_posix_perm_map[i].p_perm);
if (r == -1) {
archive_set_error(&a->archive, errno,
"Failed to check permission in an ACL "
"permission set");
return (ARCHIVE_WARN);
} else if (r)
ae_perm |= acl_posix_perm_map[i].a_perm;
}
archive_entry_acl_add_entry(entry, entry_acl_type,
ae_perm, ae_tag,
ae_id, ae_name);
s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
if (s == -1) {
archive_set_error(&a->archive, errno,
"Failed to get next ACL entry");
return (ARCHIVE_WARN);
}
}
return (ARCHIVE_OK);
}
#endif /* ARCHIVE_ACL_LIBACL */
#if ARCHIVE_ACL_LIBRICHACL
/*
* Translate RichACL into libarchive internal ACL
*/
static int
translate_richacl(struct archive_read_disk *a, struct archive_entry *entry,
struct richacl *richacl)
{
int ae_id, ae_tag, ae_perm;
int entry_acl_type, i;
const char *ae_name;
struct richace *richace;
richacl_for_each_entry(richace, richacl) {
ae_name = NULL;
ae_tag = 0;
ae_perm = 0;
ae_id = -1;
switch (richace->e_type) {
case RICHACE_ACCESS_ALLOWED_ACE_TYPE:
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALLOW;
break;
case RICHACE_ACCESS_DENIED_ACE_TYPE:
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_DENY;
break;
default: /* Unknown entry type, skip */
continue;
}
/* Unsupported */
if (richace->e_flags & RICHACE_UNMAPPED_WHO)
continue;
if (richace->e_flags & RICHACE_SPECIAL_WHO) {
switch (richace->e_id) {
case RICHACE_OWNER_SPECIAL_ID:
ae_tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
break;
case RICHACE_GROUP_SPECIAL_ID:
ae_tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
break;
case RICHACE_EVERYONE_SPECIAL_ID:
ae_tag = ARCHIVE_ENTRY_ACL_EVERYONE;
break;
default: /* Unknown special ID type */
continue;
}
} else {
ae_id = richace->e_id;
if (richace->e_flags & RICHACE_IDENTIFIER_GROUP) {
ae_tag = ARCHIVE_ENTRY_ACL_GROUP;
ae_name = archive_read_disk_gname(&a->archive,
(gid_t)(richace->e_id));
} else {
ae_tag = ARCHIVE_ENTRY_ACL_USER;
ae_name = archive_read_disk_uname(&a->archive,
(uid_t)(richace->e_id));
}
}
for (i = 0; i < acl_nfs4_flag_map_size; ++i) {
if ((richace->e_flags &
acl_nfs4_flag_map[i].p_perm) != 0)
ae_perm |= acl_nfs4_flag_map[i].a_perm;
}
for (i = 0; i < acl_nfs4_perm_map_size; ++i) {
if ((richace->e_mask &
acl_nfs4_perm_map[i].p_perm) != 0)
ae_perm |=
acl_nfs4_perm_map[i].a_perm;
}
archive_entry_acl_add_entry(entry, entry_acl_type,
ae_perm, ae_tag, ae_id, ae_name);
}
return (ARCHIVE_OK);
}
#endif /* ARCHIVE_ACL_LIBRICHACL */
#if ARCHIVE_ACL_LIBRICHACL
static int
_richacl_mode_to_mask(short mode)
{
int mask = 0;
if (mode & S_IROTH)
mask |= RICHACE_POSIX_MODE_READ;
if (mode & S_IWOTH)
mask |= RICHACE_POSIX_MODE_WRITE;
if (mode & S_IXOTH)
mask |= RICHACE_POSIX_MODE_EXEC;
return (mask);
}
static void
_richacl_mode_to_masks(struct richacl *richacl, __LA_MODE_T mode)
{
richacl->a_owner_mask = _richacl_mode_to_mask((mode & 0700) >> 6);
richacl->a_group_mask = _richacl_mode_to_mask((mode & 0070) >> 3);
richacl->a_other_mask = _richacl_mode_to_mask(mode & 0007);
}
#endif /* ARCHIVE_ACL_LIBRICHACL */
#if ARCHIVE_ACL_LIBRICHACL
static int
set_richacl(struct archive *a, int fd, const char *name,
struct archive_acl *abstract_acl, __LA_MODE_T mode,
int ae_requested_type, const char *tname)
{
int ae_type, ae_permset, ae_tag, ae_id;
uid_t ae_uid;
gid_t ae_gid;
const char *ae_name;
int entries;
int i;
int ret;
int e = 0;
struct richacl *richacl = NULL;
struct richace *richace;
ret = ARCHIVE_OK;
entries = archive_acl_reset(abstract_acl, ae_requested_type);
if (entries == 0)
return (ARCHIVE_OK);
if (ae_requested_type != ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
errno = ENOENT;
archive_set_error(a, errno, "Unsupported ACL type");
return (ARCHIVE_FAILED);
}
richacl = richacl_alloc(entries);
if (richacl == NULL) {
archive_set_error(a, errno,
"Failed to initialize RichACL working storage");
return (ARCHIVE_FAILED);
}
e = 0;
while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type,
&ae_permset, &ae_tag, &ae_id, &ae_name) == ARCHIVE_OK) {
richace = &(richacl->a_entries[e]);
richace->e_flags = 0;
richace->e_mask = 0;
switch (ae_tag) {
case ARCHIVE_ENTRY_ACL_USER:
ae_uid = archive_write_disk_uid(a, ae_name, ae_id);
richace->e_id = ae_uid;
break;
case ARCHIVE_ENTRY_ACL_GROUP:
ae_gid = archive_write_disk_gid(a, ae_name, ae_id);
richace->e_id = ae_gid;
richace->e_flags |= RICHACE_IDENTIFIER_GROUP;
break;
case ARCHIVE_ENTRY_ACL_USER_OBJ:
richace->e_flags |= RICHACE_SPECIAL_WHO;
richace->e_id = RICHACE_OWNER_SPECIAL_ID;
break;
case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
richace->e_flags |= RICHACE_SPECIAL_WHO;
richace->e_id = RICHACE_GROUP_SPECIAL_ID;
break;
case ARCHIVE_ENTRY_ACL_EVERYONE:
richace->e_flags |= RICHACE_SPECIAL_WHO;
richace->e_id = RICHACE_EVERYONE_SPECIAL_ID;
break;
default:
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Unsupported ACL tag");
ret = ARCHIVE_FAILED;
goto exit_free;
}
switch (ae_type) {
case ARCHIVE_ENTRY_ACL_TYPE_ALLOW:
richace->e_type =
RICHACE_ACCESS_ALLOWED_ACE_TYPE;
break;
case ARCHIVE_ENTRY_ACL_TYPE_DENY:
richace->e_type =
RICHACE_ACCESS_DENIED_ACE_TYPE;
break;
case ARCHIVE_ENTRY_ACL_TYPE_AUDIT:
case ARCHIVE_ENTRY_ACL_TYPE_ALARM:
break;
default:
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Unsupported ACL entry type");
ret = ARCHIVE_FAILED;
goto exit_free;
}
for (i = 0; i < acl_nfs4_perm_map_size; ++i) {
if (ae_permset & acl_nfs4_perm_map[i].a_perm)
richace->e_mask |= acl_nfs4_perm_map[i].p_perm;
}
for (i = 0; i < acl_nfs4_flag_map_size; ++i) {
if (ae_permset &
acl_nfs4_flag_map[i].a_perm)
richace->e_flags |= acl_nfs4_flag_map[i].p_perm;
}
e++;
}
/* Fill RichACL masks */
_richacl_mode_to_masks(richacl, mode);
if (fd >= 0) {
if (richacl_set_fd(fd, richacl) == 0)
ret = ARCHIVE_OK;
else {
if (errno == EOPNOTSUPP) {
/* Filesystem doesn't support ACLs */
ret = ARCHIVE_OK;
} else {
archive_set_error(a, errno,
"Failed to set richacl on fd: %s", tname);
ret = ARCHIVE_WARN;
}
}
} else if (richacl_set_file(name, richacl) != 0) {
if (errno == EOPNOTSUPP) {
/* Filesystem doesn't support ACLs */
ret = ARCHIVE_OK;
} else {
archive_set_error(a, errno, "Failed to set richacl: %s",
tname);
ret = ARCHIVE_WARN;
}
}
exit_free:
richacl_free(richacl);
return (ret);
}
#endif /* ARCHIVE_ACL_RICHACL */
#if ARCHIVE_ACL_LIBACL
static int
set_acl(struct archive *a, int fd, const char *name,
struct archive_acl *abstract_acl,
int ae_requested_type, const char *tname)
{
int acl_type = 0;
int ae_type, ae_permset, ae_tag, ae_id;
uid_t ae_uid;
gid_t ae_gid;
const char *ae_name;
int entries;
int i;
int ret;
acl_t acl = NULL;
acl_entry_t acl_entry;
acl_permset_t acl_permset;
ret = ARCHIVE_OK;
entries = archive_acl_reset(abstract_acl, ae_requested_type);
if (entries == 0)
return (ARCHIVE_OK);
switch (ae_requested_type) {
case ARCHIVE_ENTRY_ACL_TYPE_ACCESS:
acl_type = ACL_TYPE_ACCESS;
break;
case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
acl_type = ACL_TYPE_DEFAULT;
break;
default:
errno = ENOENT;
archive_set_error(a, errno, "Unsupported ACL type");
return (ARCHIVE_FAILED);
}
acl = acl_init(entries);
if (acl == (acl_t)NULL) {
archive_set_error(a, errno,
"Failed to initialize ACL working storage");
return (ARCHIVE_FAILED);
}
while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type,
&ae_permset, &ae_tag, &ae_id, &ae_name) == ARCHIVE_OK) {
if (acl_create_entry(&acl, &acl_entry) != 0) {
archive_set_error(a, errno,
"Failed to create a new ACL entry");
ret = ARCHIVE_FAILED;
goto exit_free;
}
switch (ae_tag) {
case ARCHIVE_ENTRY_ACL_USER:
ae_uid = archive_write_disk_uid(a, ae_name, ae_id);
acl_set_tag_type(acl_entry, ACL_USER);
acl_set_qualifier(acl_entry, &ae_uid);
break;
case ARCHIVE_ENTRY_ACL_GROUP:
ae_gid = archive_write_disk_gid(a, ae_name, ae_id);
acl_set_tag_type(acl_entry, ACL_GROUP);
acl_set_qualifier(acl_entry, &ae_gid);
break;
case ARCHIVE_ENTRY_ACL_USER_OBJ:
acl_set_tag_type(acl_entry, ACL_USER_OBJ);
break;
case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
acl_set_tag_type(acl_entry, ACL_GROUP_OBJ);
break;
case ARCHIVE_ENTRY_ACL_MASK:
acl_set_tag_type(acl_entry, ACL_MASK);
break;
case ARCHIVE_ENTRY_ACL_OTHER:
acl_set_tag_type(acl_entry, ACL_OTHER);
break;
default:
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Unsupported ACL tag");
ret = ARCHIVE_FAILED;
goto exit_free;
}
if (acl_get_permset(acl_entry, &acl_permset) != 0) {
archive_set_error(a, errno,
"Failed to get ACL permission set");
ret = ARCHIVE_FAILED;
goto exit_free;
}
if (acl_clear_perms(acl_permset) != 0) {
archive_set_error(a, errno,
"Failed to clear ACL permissions");
ret = ARCHIVE_FAILED;
goto exit_free;
}
for (i = 0; i < acl_posix_perm_map_size; ++i) {
if (ae_permset & acl_posix_perm_map[i].a_perm) {
if (acl_add_perm(acl_permset,
acl_posix_perm_map[i].p_perm) != 0) {
archive_set_error(a, errno,
"Failed to add ACL permission");
ret = ARCHIVE_FAILED;
goto exit_free;
}
}
}
}
if (fd >= 0 && ae_requested_type == ARCHIVE_ENTRY_ACL_TYPE_ACCESS) {
if (acl_set_fd(fd, acl) == 0)
ret = ARCHIVE_OK;
else {
if (errno == EOPNOTSUPP) {
/* Filesystem doesn't support ACLs */
ret = ARCHIVE_OK;
} else {
archive_set_error(a, errno,
"Failed to set acl on fd: %s", tname);
ret = ARCHIVE_WARN;
}
}
} else if (acl_set_file(name, acl_type, acl) != 0) {
if (errno == EOPNOTSUPP) {
/* Filesystem doesn't support ACLs */
ret = ARCHIVE_OK;
} else {
archive_set_error(a, errno, "Failed to set acl: %s",
tname);
ret = ARCHIVE_WARN;
}
}
exit_free:
acl_free(acl);
return (ret);
}
#endif /* ARCHIVE_ACL_LIBACL */
int
archive_read_disk_entry_setup_acls(struct archive_read_disk *a,
struct archive_entry *entry, int *fd)
{
const char *accpath;
int r;
#if ARCHIVE_ACL_LIBACL
acl_t acl;
#endif
#if ARCHIVE_ACL_LIBRICHACL
struct richacl *richacl;
mode_t mode;
#endif
accpath = NULL;
r = ARCHIVE_OK;
/* For default ACLs we need reachable accpath */
if (*fd < 0 || S_ISDIR(archive_entry_mode(entry))) {
accpath = archive_read_disk_entry_setup_path(a, entry, fd);
if (accpath == NULL)
return (ARCHIVE_WARN);
}
archive_entry_acl_clear(entry);
#if ARCHIVE_ACL_LIBACL
acl = NULL;
#endif
#if ARCHIVE_ACL_LIBRICHACL
richacl = NULL;
#endif
#if ARCHIVE_ACL_LIBRICHACL
/* Try NFSv4 ACL first. */
if (*fd >= 0)
richacl = richacl_get_fd(*fd);
else if ((!a->follow_symlinks)
&& (archive_entry_filetype(entry) == AE_IFLNK))
/* We can't get the ACL of a symlink, so we assume it can't
have one */
richacl = NULL;
else
richacl = richacl_get_file(accpath);
/* Ignore "trivial" ACLs that just mirror the file mode. */
if (richacl != NULL) {
mode = archive_entry_mode(entry);
if (richacl_equiv_mode(richacl, &mode) == 0) {
richacl_free(richacl);
richacl = NULL;
return (ARCHIVE_OK);
}
}
if (richacl != NULL) {
r = translate_richacl(a, entry, richacl);
richacl_free(richacl);
richacl = NULL;
if (r != ARCHIVE_OK) {
archive_set_error(&a->archive, errno,
"Couldn't translate NFSv4 ACLs");
}
return (r);
}
#endif /* ARCHIVE_ACL_LIBRICHACL */
#if ARCHIVE_ACL_LIBACL
/* Retrieve access ACL from file. */
if (*fd >= 0)
acl = acl_get_fd(*fd);
else if ((!a->follow_symlinks)
&& (archive_entry_filetype(entry) == AE_IFLNK))
/* We can't get the ACL of a symlink, so we assume it can't
have one. */
acl = NULL;
else
acl = acl_get_file(accpath, ACL_TYPE_ACCESS);
if (acl != NULL) {
r = translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
acl_free(acl);
acl = NULL;
if (r != ARCHIVE_OK) {
archive_set_error(&a->archive, errno,
"Couldn't translate access ACLs");
return (r);
}
}
/* Only directories can have default ACLs. */
if (S_ISDIR(archive_entry_mode(entry))) {
acl = acl_get_file(accpath, ACL_TYPE_DEFAULT);
if (acl != NULL) {
r = translate_acl(a, entry, acl,
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
acl_free(acl);
if (r != ARCHIVE_OK) {
archive_set_error(&a->archive, errno,
"Couldn't translate default ACLs");
return (r);
}
}
}
#endif /* ARCHIVE_ACL_LIBACL */
return (r);
}
int
archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
struct archive_acl *abstract_acl, __LA_MODE_T mode)
{
int ret = ARCHIVE_OK;
#if !ARCHIVE_ACL_LIBRICHACL
(void)mode; /* UNUSED */
#endif
#if ARCHIVE_ACL_LIBRICHACL
if ((archive_acl_types(abstract_acl)
& ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
ret = set_richacl(a, fd, name, abstract_acl, mode,
ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4");
}
#if ARCHIVE_ACL_LIBACL
else
#endif
#endif /* ARCHIVE_ACL_LIBRICHACL */
#if ARCHIVE_ACL_LIBACL
if ((archive_acl_types(abstract_acl)
& ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
if ((archive_acl_types(abstract_acl)
& ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
ret = set_acl(a, fd, name, abstract_acl,
ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access");
if (ret != ARCHIVE_OK)
return (ret);
}
if ((archive_acl_types(abstract_acl)
& ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0)
ret = set_acl(a, fd, name, abstract_acl,
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default");
}
#endif /* ARCHIVE_ACL_LIBACL */
return (ret);
}
#endif /* ARCHIVE_ACL_LIBACL || ARCHIVE_ACL_LIBRICHACL */

View File

@ -1,819 +0,0 @@
/*-
* Copyright (c) 2017 Martin Matuska
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
#if ARCHIVE_ACL_SUNOS
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_ACL_H
#define _ACL_PRIVATE /* For debugging */
#include <sys/acl.h>
#endif
#include "archive_entry.h"
#include "archive_private.h"
#include "archive_read_disk_private.h"
#include "archive_write_disk_private.h"
typedef struct {
const int a_perm; /* Libarchive permission or flag */
const int p_perm; /* Platform permission or flag */
} acl_perm_map_t;
static const acl_perm_map_t acl_posix_perm_map[] = {
{ARCHIVE_ENTRY_ACL_EXECUTE, S_IXOTH },
{ARCHIVE_ENTRY_ACL_WRITE, S_IWOTH },
{ARCHIVE_ENTRY_ACL_READ, S_IROTH }
};
static const int acl_posix_perm_map_size =
(int)(sizeof(acl_posix_perm_map)/sizeof(acl_posix_perm_map[0]));
#if ARCHIVE_ACL_SUNOS_NFS4
static const acl_perm_map_t acl_nfs4_perm_map[] = {
{ARCHIVE_ENTRY_ACL_EXECUTE, ACE_EXECUTE},
{ARCHIVE_ENTRY_ACL_READ_DATA, ACE_READ_DATA},
{ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACE_LIST_DIRECTORY},
{ARCHIVE_ENTRY_ACL_WRITE_DATA, ACE_WRITE_DATA},
{ARCHIVE_ENTRY_ACL_ADD_FILE, ACE_ADD_FILE},
{ARCHIVE_ENTRY_ACL_APPEND_DATA, ACE_APPEND_DATA},
{ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY, ACE_ADD_SUBDIRECTORY},
{ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, ACE_READ_NAMED_ATTRS},
{ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, ACE_WRITE_NAMED_ATTRS},
{ARCHIVE_ENTRY_ACL_DELETE_CHILD, ACE_DELETE_CHILD},
{ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, ACE_READ_ATTRIBUTES},
{ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, ACE_WRITE_ATTRIBUTES},
{ARCHIVE_ENTRY_ACL_DELETE, ACE_DELETE},
{ARCHIVE_ENTRY_ACL_READ_ACL, ACE_READ_ACL},
{ARCHIVE_ENTRY_ACL_WRITE_ACL, ACE_WRITE_ACL},
{ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACE_WRITE_OWNER},
{ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACE_SYNCHRONIZE}
};
static const int acl_nfs4_perm_map_size =
(int)(sizeof(acl_nfs4_perm_map)/sizeof(acl_nfs4_perm_map[0]));
static const acl_perm_map_t acl_nfs4_flag_map[] = {
{ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACE_FILE_INHERIT_ACE},
{ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACE_DIRECTORY_INHERIT_ACE},
{ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACE_NO_PROPAGATE_INHERIT_ACE},
{ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACE_INHERIT_ONLY_ACE},
{ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, ACE_SUCCESSFUL_ACCESS_ACE_FLAG},
{ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, ACE_FAILED_ACCESS_ACE_FLAG},
#ifdef ACE_INHERITED_ACE
{ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACE_INHERITED_ACE}
#endif
};
const int acl_nfs4_flag_map_size =
(int)(sizeof(acl_nfs4_flag_map)/sizeof(acl_nfs4_flag_map[0]));
#endif /* ARCHIVE_ACL_SUNOS_NFS4 */
static void *
sunacl_get(int cmd, int *aclcnt, int fd, const char *path)
{
int cnt, cntcmd;
size_t size;
void *aclp;
if (cmd == GETACL) {
cntcmd = GETACLCNT;
size = sizeof(aclent_t);
}
#if ARCHIVE_ACL_SUNOS_NFS4
else if (cmd == ACE_GETACL) {
cntcmd = ACE_GETACLCNT;
size = sizeof(ace_t);
}
#endif
else {
errno = EINVAL;
*aclcnt = -1;
return (NULL);
}
aclp = NULL;
cnt = -2;
while (cnt == -2 || (cnt == -1 && errno == ENOSPC)) {
if (path != NULL)
cnt = acl(path, cntcmd, 0, NULL);
else
cnt = facl(fd, cntcmd, 0, NULL);
if (cnt > 0) {
if (aclp == NULL)
aclp = malloc(cnt * size);
else
aclp = realloc(NULL, cnt * size);
if (aclp != NULL) {
if (path != NULL)
cnt = acl(path, cmd, cnt, aclp);
else
cnt = facl(fd, cmd, cnt, aclp);
}
} else {
free(aclp);
aclp = NULL;
break;
}
}
*aclcnt = cnt;
return (aclp);
}
/*
* Check if acl is trivial
* This is a FreeBSD acl_is_trivial_np() implementation for Solaris
*/
static int
sun_acl_is_trivial(void *aclp, int aclcnt, mode_t mode, int is_nfs4,
int is_dir, int *trivialp)
{
#if ARCHIVE_ACL_SUNOS_NFS4
int i, p;
const uint32_t rperm = ACE_READ_DATA;
const uint32_t wperm = ACE_WRITE_DATA | ACE_APPEND_DATA;
const uint32_t eperm = ACE_EXECUTE;
const uint32_t pubset = ACE_READ_ATTRIBUTES | ACE_READ_NAMED_ATTRS |
ACE_READ_ACL | ACE_SYNCHRONIZE;
const uint32_t ownset = pubset | ACE_WRITE_ATTRIBUTES |
ACE_WRITE_NAMED_ATTRS | ACE_WRITE_ACL | ACE_WRITE_OWNER;
ace_t *ace;
ace_t tace[6];
#endif
if (aclp == NULL || trivialp == NULL)
return (-1);
*trivialp = 0;
/*
* POSIX.1e ACLs marked with ACL_IS_TRIVIAL are compatible with
* FreeBSD acl_is_trivial_np(). On Solaris they have 4 entries,
* including mask.
*/
if (!is_nfs4) {
if (aclcnt == 4)
*trivialp = 1;
return (0);
}
#if ARCHIVE_ACL_SUNOS_NFS4
/*
* Continue with checking NFSv4 ACLs
*
* Create list of trivial ace's to be compared
*/
/* owner@ allow pre */
tace[0].a_flags = ACE_OWNER;
tace[0].a_type = ACE_ACCESS_ALLOWED_ACE_TYPE;
tace[0].a_access_mask = 0;
/* owner@ deny */
tace[1].a_flags = ACE_OWNER;
tace[1].a_type = ACE_ACCESS_DENIED_ACE_TYPE;
tace[1].a_access_mask = 0;
/* group@ deny */
tace[2].a_flags = ACE_GROUP | ACE_IDENTIFIER_GROUP;
tace[2].a_type = ACE_ACCESS_DENIED_ACE_TYPE;
tace[2].a_access_mask = 0;
/* owner@ allow */
tace[3].a_flags = ACE_OWNER;
tace[3].a_type = ACE_ACCESS_ALLOWED_ACE_TYPE;
tace[3].a_access_mask = ownset;
/* group@ allow */
tace[4].a_flags = ACE_GROUP | ACE_IDENTIFIER_GROUP;
tace[4].a_type = ACE_ACCESS_ALLOWED_ACE_TYPE;
tace[4].a_access_mask = pubset;
/* everyone@ allow */
tace[5].a_flags = ACE_EVERYONE;
tace[5].a_type = ACE_ACCESS_ALLOWED_ACE_TYPE;
tace[5].a_access_mask = pubset;
/* Permissions for everyone@ */
if (mode & 0004)
tace[5].a_access_mask |= rperm;
if (mode & 0002)
tace[5].a_access_mask |= wperm;
if (mode & 0001)
tace[5].a_access_mask |= eperm;
/* Permissions for group@ */
if (mode & 0040)
tace[4].a_access_mask |= rperm;
else if (mode & 0004)
tace[2].a_access_mask |= rperm;
if (mode & 0020)
tace[4].a_access_mask |= wperm;
else if (mode & 0002)
tace[2].a_access_mask |= wperm;
if (mode & 0010)
tace[4].a_access_mask |= eperm;
else if (mode & 0001)
tace[2].a_access_mask |= eperm;
/* Permissions for owner@ */
if (mode & 0400) {
tace[3].a_access_mask |= rperm;
if (!(mode & 0040) && (mode & 0004))
tace[0].a_access_mask |= rperm;
} else if ((mode & 0040) || (mode & 0004))
tace[1].a_access_mask |= rperm;
if (mode & 0200) {
tace[3].a_access_mask |= wperm;
if (!(mode & 0020) && (mode & 0002))
tace[0].a_access_mask |= wperm;
} else if ((mode & 0020) || (mode & 0002))
tace[1].a_access_mask |= wperm;
if (mode & 0100) {
tace[3].a_access_mask |= eperm;
if (!(mode & 0010) && (mode & 0001))
tace[0].a_access_mask |= eperm;
} else if ((mode & 0010) || (mode & 0001))
tace[1].a_access_mask |= eperm;
/* Check if the acl count matches */
p = 3;
for (i = 0; i < 3; i++) {
if (tace[i].a_access_mask != 0)
p++;
}
if (aclcnt != p)
return (0);
p = 0;
for (i = 0; i < 6; i++) {
if (tace[i].a_access_mask != 0) {
ace = &((ace_t *)aclp)[p];
/*
* Illumos added ACE_DELETE_CHILD to write perms for
* directories. We have to check against that, too.
*/
if (ace->a_flags != tace[i].a_flags ||
ace->a_type != tace[i].a_type ||
(ace->a_access_mask != tace[i].a_access_mask &&
(!is_dir || (tace[i].a_access_mask & wperm) == 0 ||
ace->a_access_mask !=
(tace[i].a_access_mask | ACE_DELETE_CHILD))))
return (0);
p++;
}
}
*trivialp = 1;
#else /* !ARCHIVE_ACL_SUNOS_NFS4 */
(void)is_dir; /* UNUSED */
(void)aclp; /* UNUSED */
#endif /* !ARCHIVE_ACL_SUNOS_NFS4 */
return (0);
}
/*
* Translate Solaris POSIX.1e and NFSv4 ACLs into libarchive internal ACL
*/
static int
translate_acl(struct archive_read_disk *a,
struct archive_entry *entry, void *aclp, int aclcnt,
int default_entry_acl_type)
{
int e, i;
int ae_id, ae_tag, ae_perm;
int entry_acl_type;
const char *ae_name;
aclent_t *aclent;
#if ARCHIVE_ACL_SUNOS_NFS4
ace_t *ace;
#endif
if (aclcnt <= 0)
return (ARCHIVE_OK);
for (e = 0; e < aclcnt; e++) {
ae_name = NULL;
ae_tag = 0;
ae_perm = 0;
#if ARCHIVE_ACL_SUNOS_NFS4
if (default_entry_acl_type == ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
ace = &((ace_t *)aclp)[e];
ae_id = ace->a_who;
switch(ace->a_type) {
case ACE_ACCESS_ALLOWED_ACE_TYPE:
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALLOW;
break;
case ACE_ACCESS_DENIED_ACE_TYPE:
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_DENY;
break;
case ACE_SYSTEM_AUDIT_ACE_TYPE:
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS;
break;
case ACE_SYSTEM_ALARM_ACE_TYPE:
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALARM;
break;
default:
/* Unknown entry type, skip */
continue;
}
if ((ace->a_flags & ACE_OWNER) != 0)
ae_tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
else if ((ace->a_flags & ACE_GROUP) != 0)
ae_tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
else if ((ace->a_flags & ACE_EVERYONE) != 0)
ae_tag = ARCHIVE_ENTRY_ACL_EVERYONE;
else if ((ace->a_flags & ACE_IDENTIFIER_GROUP) != 0) {
ae_tag = ARCHIVE_ENTRY_ACL_GROUP;
ae_name = archive_read_disk_gname(&a->archive,
ae_id);
} else {
ae_tag = ARCHIVE_ENTRY_ACL_USER;
ae_name = archive_read_disk_uname(&a->archive,
ae_id);
}
for (i = 0; i < acl_nfs4_flag_map_size; ++i) {
if ((ace->a_flags &
acl_nfs4_flag_map[i].p_perm) != 0)
ae_perm |= acl_nfs4_flag_map[i].a_perm;
}
for (i = 0; i < acl_nfs4_perm_map_size; ++i) {
if ((ace->a_access_mask &
acl_nfs4_perm_map[i].p_perm) != 0)
ae_perm |= acl_nfs4_perm_map[i].a_perm;
}
} else
#endif /* ARCHIVE_ACL_SUNOS_NFS4 */
if (default_entry_acl_type == ARCHIVE_ENTRY_ACL_TYPE_ACCESS) {
aclent = &((aclent_t *)aclp)[e];
if ((aclent->a_type & ACL_DEFAULT) != 0)
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_DEFAULT;
else
entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS;
ae_id = aclent->a_id;
switch(aclent->a_type) {
case DEF_USER:
case USER:
ae_name = archive_read_disk_uname(&a->archive,
ae_id);
ae_tag = ARCHIVE_ENTRY_ACL_USER;
break;
case DEF_GROUP:
case GROUP:
ae_name = archive_read_disk_gname(&a->archive,
ae_id);
ae_tag = ARCHIVE_ENTRY_ACL_GROUP;
break;
case DEF_CLASS_OBJ:
case CLASS_OBJ:
ae_tag = ARCHIVE_ENTRY_ACL_MASK;
break;
case DEF_USER_OBJ:
case USER_OBJ:
ae_tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
break;
case DEF_GROUP_OBJ:
case GROUP_OBJ:
ae_tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
break;
case DEF_OTHER_OBJ:
case OTHER_OBJ:
ae_tag = ARCHIVE_ENTRY_ACL_OTHER;
break;
default:
/* Unknown tag type, skip */
continue;
}
for (i = 0; i < acl_posix_perm_map_size; ++i) {
if ((aclent->a_perm &
acl_posix_perm_map[i].p_perm) != 0)
ae_perm |= acl_posix_perm_map[i].a_perm;
}
} else
return (ARCHIVE_WARN);
archive_entry_acl_add_entry(entry, entry_acl_type,
ae_perm, ae_tag, ae_id, ae_name);
}
return (ARCHIVE_OK);
}
static int
set_acl(struct archive *a, int fd, const char *name,
struct archive_acl *abstract_acl,
int ae_requested_type, const char *tname)
{
aclent_t *aclent;
#if ARCHIVE_ACL_SUNOS_NFS4
ace_t *ace;
#endif
int cmd, e, r;
void *aclp;
int ret;
int ae_type, ae_permset, ae_tag, ae_id;
int perm_map_size;
const acl_perm_map_t *perm_map;
uid_t ae_uid;
gid_t ae_gid;
const char *ae_name;
int entries;
int i;
ret = ARCHIVE_OK;
entries = archive_acl_reset(abstract_acl, ae_requested_type);
if (entries == 0)
return (ARCHIVE_OK);
switch (ae_requested_type) {
case ARCHIVE_ENTRY_ACL_TYPE_POSIX1E:
cmd = SETACL;
aclp = malloc(entries * sizeof(aclent_t));
break;
#if ARCHIVE_ACL_SUNOS_NFS4
case ARCHIVE_ENTRY_ACL_TYPE_NFS4:
cmd = ACE_SETACL;
aclp = malloc(entries * sizeof(ace_t));
break;
#endif
default:
errno = ENOENT;
archive_set_error(a, errno, "Unsupported ACL type");
return (ARCHIVE_FAILED);
}
if (aclp == NULL) {
archive_set_error(a, errno,
"Can't allocate memory for acl buffer");
return (ARCHIVE_FAILED);
}
e = 0;
while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type,
&ae_permset, &ae_tag, &ae_id, &ae_name) == ARCHIVE_OK) {
aclent = NULL;
#if ARCHIVE_ACL_SUNOS_NFS4
ace = NULL;
#endif
if (cmd == SETACL) {
aclent = &((aclent_t *)aclp)[e];
aclent->a_id = -1;
aclent->a_type = 0;
aclent->a_perm = 0;
}
#if ARCHIVE_ACL_SUNOS_NFS4
else { /* cmd == ACE_SETACL */
ace = &((ace_t *)aclp)[e];
ace->a_who = -1;
ace->a_access_mask = 0;
ace->a_flags = 0;
}
#endif /* ARCHIVE_ACL_SUNOS_NFS4 */
switch (ae_tag) {
case ARCHIVE_ENTRY_ACL_USER:
ae_uid = archive_write_disk_uid(a, ae_name, ae_id);
if (aclent != NULL) {
aclent->a_id = ae_uid;
aclent->a_type |= USER;
}
#if ARCHIVE_ACL_SUNOS_NFS4
else {
ace->a_who = ae_uid;
}
#endif
break;
case ARCHIVE_ENTRY_ACL_GROUP:
ae_gid = archive_write_disk_gid(a, ae_name, ae_id);
if (aclent != NULL) {
aclent->a_id = ae_gid;
aclent->a_type |= GROUP;
}
#if ARCHIVE_ACL_SUNOS_NFS4
else {
ace->a_who = ae_gid;
ace->a_flags |= ACE_IDENTIFIER_GROUP;
}
#endif
break;
case ARCHIVE_ENTRY_ACL_USER_OBJ:
if (aclent != NULL)
aclent->a_type |= USER_OBJ;
#if ARCHIVE_ACL_SUNOS_NFS4
else {
ace->a_flags |= ACE_OWNER;
}
#endif
break;
case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
if (aclent != NULL)
aclent->a_type |= GROUP_OBJ;
#if ARCHIVE_ACL_SUNOS_NFS4
else {
ace->a_flags |= ACE_GROUP;
ace->a_flags |= ACE_IDENTIFIER_GROUP;
}
#endif
break;
case ARCHIVE_ENTRY_ACL_MASK:
if (aclent != NULL)
aclent->a_type |= CLASS_OBJ;
break;
case ARCHIVE_ENTRY_ACL_OTHER:
if (aclent != NULL)
aclent->a_type |= OTHER_OBJ;
break;
#if ARCHIVE_ACL_SUNOS_NFS4
case ARCHIVE_ENTRY_ACL_EVERYONE:
if (ace != NULL)
ace->a_flags |= ACE_EVERYONE;
break;
#endif
default:
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Unsupported ACL tag");
ret = ARCHIVE_FAILED;
goto exit_free;
}
r = 0;
switch (ae_type) {
#if ARCHIVE_ACL_SUNOS_NFS4
case ARCHIVE_ENTRY_ACL_TYPE_ALLOW:
if (ace != NULL)
ace->a_type = ACE_ACCESS_ALLOWED_ACE_TYPE;
else
r = -1;
break;
case ARCHIVE_ENTRY_ACL_TYPE_DENY:
if (ace != NULL)
ace->a_type = ACE_ACCESS_DENIED_ACE_TYPE;
else
r = -1;
break;
case ARCHIVE_ENTRY_ACL_TYPE_AUDIT:
if (ace != NULL)
ace->a_type = ACE_SYSTEM_AUDIT_ACE_TYPE;
else
r = -1;
break;
case ARCHIVE_ENTRY_ACL_TYPE_ALARM:
if (ace != NULL)
ace->a_type = ACE_SYSTEM_ALARM_ACE_TYPE;
else
r = -1;
break;
#endif
case ARCHIVE_ENTRY_ACL_TYPE_ACCESS:
if (aclent == NULL)
r = -1;
break;
case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
if (aclent != NULL)
aclent->a_type |= ACL_DEFAULT;
else
r = -1;
break;
default:
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Unsupported ACL entry type");
ret = ARCHIVE_FAILED;
goto exit_free;
}
if (r != 0) {
errno = EINVAL;
archive_set_error(a, errno,
"Failed to set ACL entry type");
ret = ARCHIVE_FAILED;
goto exit_free;
}
#if ARCHIVE_ACL_SUNOS_NFS4
if (ae_requested_type == ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
perm_map_size = acl_nfs4_perm_map_size;
perm_map = acl_nfs4_perm_map;
} else {
#endif
perm_map_size = acl_posix_perm_map_size;
perm_map = acl_posix_perm_map;
#if ARCHIVE_ACL_SUNOS_NFS4
}
#endif
for (i = 0; i < perm_map_size; ++i) {
if (ae_permset & perm_map[i].a_perm) {
#if ARCHIVE_ACL_SUNOS_NFS4
if (ae_requested_type ==
ARCHIVE_ENTRY_ACL_TYPE_NFS4)
ace->a_access_mask |=
perm_map[i].p_perm;
else
#endif
aclent->a_perm |= perm_map[i].p_perm;
}
}
#if ARCHIVE_ACL_SUNOS_NFS4
if (ae_requested_type == ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
for (i = 0; i < acl_nfs4_flag_map_size; ++i) {
if (ae_permset & acl_nfs4_flag_map[i].a_perm) {
ace->a_flags |=
acl_nfs4_flag_map[i].p_perm;
}
}
}
#endif
e++;
}
/* Try restoring the ACL through 'fd' if we can. */
if (fd >= 0) {
if (facl(fd, cmd, entries, aclp) == 0)
ret = ARCHIVE_OK;
else {
if (errno == EOPNOTSUPP) {
/* Filesystem doesn't support ACLs */
ret = ARCHIVE_OK;
} else {
archive_set_error(a, errno,
"Failed to set acl on fd: %s", tname);
ret = ARCHIVE_WARN;
}
}
} else if (acl(name, cmd, entries, aclp) != 0) {
if (errno == EOPNOTSUPP) {
/* Filesystem doesn't support ACLs */
ret = ARCHIVE_OK;
} else {
archive_set_error(a, errno, "Failed to set acl: %s",
tname);
ret = ARCHIVE_WARN;
}
}
exit_free:
free(aclp);
return (ret);
}
int
archive_read_disk_entry_setup_acls(struct archive_read_disk *a,
struct archive_entry *entry, int *fd)
{
const char *accpath;
void *aclp;
int aclcnt;
int r;
accpath = NULL;
if (*fd < 0) {
accpath = archive_read_disk_entry_setup_path(a, entry, fd);
if (accpath == NULL)
return (ARCHIVE_WARN);
}
archive_entry_acl_clear(entry);
aclp = NULL;
#if ARCHIVE_ACL_SUNOS_NFS4
if (*fd >= 0)
aclp = sunacl_get(ACE_GETACL, &aclcnt, *fd, NULL);
else if ((!a->follow_symlinks)
&& (archive_entry_filetype(entry) == AE_IFLNK))
/* We can't get the ACL of a symlink, so we assume it can't
have one. */
aclp = NULL;
else
aclp = sunacl_get(ACE_GETACL, &aclcnt, 0, accpath);
if (aclp != NULL && sun_acl_is_trivial(aclp, aclcnt,
archive_entry_mode(entry), 1, S_ISDIR(archive_entry_mode(entry)),
&r) == 0 && r == 1) {
free(aclp);
aclp = NULL;
return (ARCHIVE_OK);
}
if (aclp != NULL) {
r = translate_acl(a, entry, aclp, aclcnt,
ARCHIVE_ENTRY_ACL_TYPE_NFS4);
free(aclp);
aclp = NULL;
if (r != ARCHIVE_OK) {
archive_set_error(&a->archive, errno,
"Couldn't translate NFSv4 ACLs");
}
return (r);
}
#endif /* ARCHIVE_ACL_SUNOS_NFS4 */
/* Retrieve POSIX.1e ACLs from file. */
if (*fd >= 0)
aclp = sunacl_get(GETACL, &aclcnt, *fd, NULL);
else if ((!a->follow_symlinks)
&& (archive_entry_filetype(entry) == AE_IFLNK))
/* We can't get the ACL of a symlink, so we assume it can't
have one. */
aclp = NULL;
else
aclp = sunacl_get(GETACL, &aclcnt, 0, accpath);
/* Ignore "trivial" ACLs that just mirror the file mode. */
if (aclp != NULL && sun_acl_is_trivial(aclp, aclcnt,
archive_entry_mode(entry), 0, S_ISDIR(archive_entry_mode(entry)),
&r) == 0 && r == 1) {
free(aclp);
aclp = NULL;
}
if (aclp != NULL)
{
r = translate_acl(a, entry, aclp, aclcnt,
ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
free(aclp);
aclp = NULL;
if (r != ARCHIVE_OK) {
archive_set_error(&a->archive, errno,
"Couldn't translate access ACLs");
return (r);
}
}
return (ARCHIVE_OK);
}
int
archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
struct archive_acl *abstract_acl, __LA_MODE_T mode)
{
int ret = ARCHIVE_OK;
(void)mode; /* UNUSED */
if ((archive_acl_types(abstract_acl)
& ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
/* Solaris writes POSIX.1e access and default ACLs together */
ret = set_acl(a, fd, name, abstract_acl,
ARCHIVE_ENTRY_ACL_TYPE_POSIX1E, "posix1e");
/* Simultaneous POSIX.1e and NFSv4 is not supported */
return (ret);
}
#if ARCHIVE_ACL_SUNOS_NFS4
else if ((archive_acl_types(abstract_acl) &
ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
ret = set_acl(a, fd, name, abstract_acl,
ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4");
}
#endif
return (ret);
}
#endif /* ARCHIVE_ACL_SUNOS */

View File

@ -1,195 +0,0 @@
/*-
* Copyright (c) 2002 Thomas Moestl <tmm@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: head/lib/libarchive/archive_endian.h 201085 2009-12-28 02:17:15Z kientzle $
*
* Borrowed from FreeBSD's <sys/endian.h>
*/
#ifndef ARCHIVE_ENDIAN_H_INCLUDED
#define ARCHIVE_ENDIAN_H_INCLUDED
/* Note: This is a purely internal header! */
/* Do not use this outside of libarchive internal code! */
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
/*
* Disabling inline keyword for compilers known to choke on it:
* - Watcom C++ in C code. (For any version?)
* - SGI MIPSpro
* - Microsoft Visual C++ 6.0 (supposedly newer versions too)
* - IBM VisualAge 6 (XL v6)
* - Sun WorkShop C (SunPro) before 5.9
*/
#if defined(__WATCOMC__) || defined(__sgi) || defined(__hpux) || defined(__BORLANDC__)
#define inline
#elif defined(__IBMC__) && __IBMC__ < 700
#define inline
#elif defined(__SUNPRO_C) && __SUNPRO_C < 0x590
#define inline
#elif defined(_MSC_VER) || defined(__osf__)
#define inline __inline
#endif
/* Alignment-agnostic encode/decode bytestream to/from little/big endian. */
static inline uint16_t
archive_be16dec(const void *pp)
{
unsigned char const *p = (unsigned char const *)pp;
/* Store into unsigned temporaries before left shifting, to avoid
promotion to signed int and then left shifting into the sign bit,
which is undefined behaviour. */
unsigned int p1 = p[1];
unsigned int p0 = p[0];
return ((p0 << 8) | p1);
}
static inline uint32_t
archive_be32dec(const void *pp)
{
unsigned char const *p = (unsigned char const *)pp;
/* Store into unsigned temporaries before left shifting, to avoid
promotion to signed int and then left shifting into the sign bit,
which is undefined behaviour. */
unsigned int p3 = p[3];
unsigned int p2 = p[2];
unsigned int p1 = p[1];
unsigned int p0 = p[0];
return ((p0 << 24) | (p1 << 16) | (p2 << 8) | p3);
}
static inline uint64_t
archive_be64dec(const void *pp)
{
unsigned char const *p = (unsigned char const *)pp;
return (((uint64_t)archive_be32dec(p) << 32) | archive_be32dec(p + 4));
}
static inline uint16_t
archive_le16dec(const void *pp)
{
unsigned char const *p = (unsigned char const *)pp;
/* Store into unsigned temporaries before left shifting, to avoid
promotion to signed int and then left shifting into the sign bit,
which is undefined behaviour. */
unsigned int p1 = p[1];
unsigned int p0 = p[0];
return ((p1 << 8) | p0);
}
static inline uint32_t
archive_le32dec(const void *pp)
{
unsigned char const *p = (unsigned char const *)pp;
/* Store into unsigned temporaries before left shifting, to avoid
promotion to signed int and then left shifting into the sign bit,
which is undefined behaviour. */
unsigned int p3 = p[3];
unsigned int p2 = p[2];
unsigned int p1 = p[1];
unsigned int p0 = p[0];
return ((p3 << 24) | (p2 << 16) | (p1 << 8) | p0);
}
static inline uint64_t
archive_le64dec(const void *pp)
{
unsigned char const *p = (unsigned char const *)pp;
return (((uint64_t)archive_le32dec(p + 4) << 32) | archive_le32dec(p));
}
static inline void
archive_be16enc(void *pp, uint16_t u)
{
unsigned char *p = (unsigned char *)pp;
p[0] = (u >> 8) & 0xff;
p[1] = u & 0xff;
}
static inline void
archive_be32enc(void *pp, uint32_t u)
{
unsigned char *p = (unsigned char *)pp;
p[0] = (u >> 24) & 0xff;
p[1] = (u >> 16) & 0xff;
p[2] = (u >> 8) & 0xff;
p[3] = u & 0xff;
}
static inline void
archive_be64enc(void *pp, uint64_t u)
{
unsigned char *p = (unsigned char *)pp;
archive_be32enc(p, (uint32_t)(u >> 32));
archive_be32enc(p + 4, (uint32_t)(u & 0xffffffff));
}
static inline void
archive_le16enc(void *pp, uint16_t u)
{
unsigned char *p = (unsigned char *)pp;
p[0] = u & 0xff;
p[1] = (u >> 8) & 0xff;
}
static inline void
archive_le32enc(void *pp, uint32_t u)
{
unsigned char *p = (unsigned char *)pp;
p[0] = u & 0xff;
p[1] = (u >> 8) & 0xff;
p[2] = (u >> 16) & 0xff;
p[3] = (u >> 24) & 0xff;
}
static inline void
archive_le64enc(void *pp, uint64_t u)
{
unsigned char *p = (unsigned char *)pp;
archive_le32enc(p, (uint32_t)(u & 0xffffffff));
archive_le32enc(p + 4, (uint32_t)(u >> 32));
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,708 +0,0 @@
/*-
* Copyright (c) 2003-2008 Tim Kientzle
* Copyright (c) 2016 Martin Matuska
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: head/lib/libarchive/archive_entry.h 201096 2009-12-28 02:41:27Z kientzle $
*/
#ifndef ARCHIVE_ENTRY_H_INCLUDED
#define ARCHIVE_ENTRY_H_INCLUDED
/* Note: Compiler will complain if this does not match archive.h! */
#define ARCHIVE_VERSION_NUMBER 3004003
/*
* Note: archive_entry.h is for use outside of libarchive; the
* configuration headers (config.h, archive_platform.h, etc.) are
* purely internal. Do NOT use HAVE_XXX configuration macros to
* control the behavior of this header! If you must conditionalize,
* use predefined compiler and/or platform macros.
*/
#include <sys/types.h>
#include <stddef.h> /* for wchar_t */
#include <stdint.h>
#include <time.h>
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <windows.h>
#endif
/* Get a suitable 64-bit integer type. */
#if !defined(__LA_INT64_T_DEFINED)
# if ARCHIVE_VERSION_NUMBER < 4000000
#define __LA_INT64_T la_int64_t
# endif
#define __LA_INT64_T_DEFINED
# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__)
typedef __int64 la_int64_t;
# else
#include <unistd.h>
# if defined(_SCO_DS) || defined(__osf__)
typedef long long la_int64_t;
# else
typedef int64_t la_int64_t;
# endif
# endif
#endif
/* The la_ssize_t should match the type used in 'struct stat' */
#if !defined(__LA_SSIZE_T_DEFINED)
/* Older code relied on the __LA_SSIZE_T macro; after 4.0 we'll switch to the typedef exclusively. */
# if ARCHIVE_VERSION_NUMBER < 4000000
#define __LA_SSIZE_T la_ssize_t
# endif
#define __LA_SSIZE_T_DEFINED
# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__)
# if defined(_SSIZE_T_DEFINED) || defined(_SSIZE_T_)
typedef ssize_t la_ssize_t;
# elif defined(_WIN64)
typedef __int64 la_ssize_t;
# else
typedef long la_ssize_t;
# endif
# else
# include <unistd.h> /* ssize_t */
typedef ssize_t la_ssize_t;
# endif
#endif
/* Get a suitable definition for mode_t */
#if ARCHIVE_VERSION_NUMBER >= 3999000
/* Switch to plain 'int' for libarchive 4.0. It's less broken than 'mode_t' */
# define __LA_MODE_T int
#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(__BORLANDC__) && !defined(__WATCOMC__)
# define __LA_MODE_T unsigned short
#else
# define __LA_MODE_T mode_t
#endif
/* Large file support for Android */
#ifdef __ANDROID__
#include "android_lf.h"
#endif
/*
* On Windows, define LIBARCHIVE_STATIC if you're building or using a
* .lib. The default here assumes you're building a DLL. Only
* libarchive source should ever define __LIBARCHIVE_BUILD.
*/
#if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)
# ifdef __LIBARCHIVE_BUILD
# ifdef __GNUC__
# define __LA_DECL __attribute__((dllexport)) extern
# else
# define __LA_DECL __declspec(dllexport)
# endif
# else
# ifdef __GNUC__
# define __LA_DECL
# else
# define __LA_DECL __declspec(dllimport)
# endif
# endif
#else
/* Static libraries on all platforms and shared libraries on non-Windows. */
# define __LA_DECL
#endif
#if defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >= 1
# define __LA_DEPRECATED __attribute__((deprecated))
#else
# define __LA_DEPRECATED
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Description of an archive entry.
*
* You can think of this as "struct stat" with some text fields added in.
*
* TODO: Add "comment", "charset", and possibly other entries that are
* supported by "pax interchange" format. However, GNU, ustar, cpio,
* and other variants don't support these features, so they're not an
* excruciatingly high priority right now.
*
* TODO: "pax interchange" format allows essentially arbitrary
* key/value attributes to be attached to any entry. Supporting
* such extensions may make this library useful for special
* applications (e.g., a package manager could attach special
* package-management attributes to each entry).
*/
struct archive;
struct archive_entry;
/*
* File-type constants. These are returned from archive_entry_filetype()
* and passed to archive_entry_set_filetype().
*
* These values match S_XXX defines on every platform I've checked,
* including Windows, AIX, Linux, Solaris, and BSD. They're
* (re)defined here because platforms generally don't define the ones
* they don't support. For example, Windows doesn't define S_IFLNK or
* S_IFBLK. Instead of having a mass of conditional logic and system
* checks to define any S_XXX values that aren't supported locally,
* I've just defined a new set of such constants so that
* libarchive-based applications can manipulate and identify archive
* entries properly even if the hosting platform can't store them on
* disk.
*
* These values are also used directly within some portable formats,
* such as cpio. If you find a platform that varies from these, the
* correct solution is to leave these alone and translate from these
* portable values to platform-native values when entries are read from
* or written to disk.
*/
/*
* In libarchive 4.0, we can drop the casts here.
* They're needed to work around Borland C's broken mode_t.
*/
#define AE_IFMT ((__LA_MODE_T)0170000)
#define AE_IFREG ((__LA_MODE_T)0100000)
#define AE_IFLNK ((__LA_MODE_T)0120000)
#define AE_IFSOCK ((__LA_MODE_T)0140000)
#define AE_IFCHR ((__LA_MODE_T)0020000)
#define AE_IFBLK ((__LA_MODE_T)0060000)
#define AE_IFDIR ((__LA_MODE_T)0040000)
#define AE_IFIFO ((__LA_MODE_T)0010000)
/*
* Symlink types
*/
#define AE_SYMLINK_TYPE_UNDEFINED 0
#define AE_SYMLINK_TYPE_FILE 1
#define AE_SYMLINK_TYPE_DIRECTORY 2
/*
* Basic object manipulation
*/
__LA_DECL struct archive_entry *archive_entry_clear(struct archive_entry *);
/* The 'clone' function does a deep copy; all of the strings are copied too. */
__LA_DECL struct archive_entry *archive_entry_clone(struct archive_entry *);
__LA_DECL void archive_entry_free(struct archive_entry *);
__LA_DECL struct archive_entry *archive_entry_new(void);
/*
* This form of archive_entry_new2() will pull character-set
* conversion information from the specified archive handle. The
* older archive_entry_new(void) form is equivalent to calling
* archive_entry_new2(NULL) and will result in the use of an internal
* default character-set conversion.
*/
__LA_DECL struct archive_entry *archive_entry_new2(struct archive *);
/*
* Retrieve fields from an archive_entry.
*
* There are a number of implicit conversions among these fields. For
* example, if a regular string field is set and you read the _w wide
* character field, the entry will implicitly convert narrow-to-wide
* using the current locale. Similarly, dev values are automatically
* updated when you write devmajor or devminor and vice versa.
*
* In addition, fields can be "set" or "unset." Unset string fields
* return NULL, non-string fields have _is_set() functions to test
* whether they've been set. You can "unset" a string field by
* assigning NULL; non-string fields have _unset() functions to
* unset them.
*
* Note: There is one ambiguity in the above; string fields will
* also return NULL when implicit character set conversions fail.
* This is usually what you want.
*/
__LA_DECL time_t archive_entry_atime(struct archive_entry *);
__LA_DECL long archive_entry_atime_nsec(struct archive_entry *);
__LA_DECL int archive_entry_atime_is_set(struct archive_entry *);
__LA_DECL time_t archive_entry_birthtime(struct archive_entry *);
__LA_DECL long archive_entry_birthtime_nsec(struct archive_entry *);
__LA_DECL int archive_entry_birthtime_is_set(struct archive_entry *);
__LA_DECL time_t archive_entry_ctime(struct archive_entry *);
__LA_DECL long archive_entry_ctime_nsec(struct archive_entry *);
__LA_DECL int archive_entry_ctime_is_set(struct archive_entry *);
__LA_DECL dev_t archive_entry_dev(struct archive_entry *);
__LA_DECL int archive_entry_dev_is_set(struct archive_entry *);
__LA_DECL dev_t archive_entry_devmajor(struct archive_entry *);
__LA_DECL dev_t archive_entry_devminor(struct archive_entry *);
__LA_DECL __LA_MODE_T archive_entry_filetype(struct archive_entry *);
__LA_DECL void archive_entry_fflags(struct archive_entry *,
unsigned long * /* set */,
unsigned long * /* clear */);
__LA_DECL const char *archive_entry_fflags_text(struct archive_entry *);
__LA_DECL la_int64_t archive_entry_gid(struct archive_entry *);
__LA_DECL const char *archive_entry_gname(struct archive_entry *);
__LA_DECL const char *archive_entry_gname_utf8(struct archive_entry *);
__LA_DECL const wchar_t *archive_entry_gname_w(struct archive_entry *);
__LA_DECL const char *archive_entry_hardlink(struct archive_entry *);
__LA_DECL const char *archive_entry_hardlink_utf8(struct archive_entry *);
__LA_DECL const wchar_t *archive_entry_hardlink_w(struct archive_entry *);
__LA_DECL la_int64_t archive_entry_ino(struct archive_entry *);
__LA_DECL la_int64_t archive_entry_ino64(struct archive_entry *);
__LA_DECL int archive_entry_ino_is_set(struct archive_entry *);
__LA_DECL __LA_MODE_T archive_entry_mode(struct archive_entry *);
__LA_DECL time_t archive_entry_mtime(struct archive_entry *);
__LA_DECL long archive_entry_mtime_nsec(struct archive_entry *);
__LA_DECL int archive_entry_mtime_is_set(struct archive_entry *);
__LA_DECL unsigned int archive_entry_nlink(struct archive_entry *);
__LA_DECL const char *archive_entry_pathname(struct archive_entry *);
__LA_DECL const char *archive_entry_pathname_utf8(struct archive_entry *);
__LA_DECL const wchar_t *archive_entry_pathname_w(struct archive_entry *);
__LA_DECL __LA_MODE_T archive_entry_perm(struct archive_entry *);
__LA_DECL dev_t archive_entry_rdev(struct archive_entry *);
__LA_DECL dev_t archive_entry_rdevmajor(struct archive_entry *);
__LA_DECL dev_t archive_entry_rdevminor(struct archive_entry *);
__LA_DECL const char *archive_entry_sourcepath(struct archive_entry *);
__LA_DECL const wchar_t *archive_entry_sourcepath_w(struct archive_entry *);
__LA_DECL la_int64_t archive_entry_size(struct archive_entry *);
__LA_DECL int archive_entry_size_is_set(struct archive_entry *);
__LA_DECL const char *archive_entry_strmode(struct archive_entry *);
__LA_DECL const char *archive_entry_symlink(struct archive_entry *);
__LA_DECL const char *archive_entry_symlink_utf8(struct archive_entry *);
__LA_DECL int archive_entry_symlink_type(struct archive_entry *);
__LA_DECL const wchar_t *archive_entry_symlink_w(struct archive_entry *);
__LA_DECL la_int64_t archive_entry_uid(struct archive_entry *);
__LA_DECL const char *archive_entry_uname(struct archive_entry *);
__LA_DECL const char *archive_entry_uname_utf8(struct archive_entry *);
__LA_DECL const wchar_t *archive_entry_uname_w(struct archive_entry *);
__LA_DECL int archive_entry_is_data_encrypted(struct archive_entry *);
__LA_DECL int archive_entry_is_metadata_encrypted(struct archive_entry *);
__LA_DECL int archive_entry_is_encrypted(struct archive_entry *);
/*
* Set fields in an archive_entry.
*
* Note: Before libarchive 2.4, there were 'set' and 'copy' versions
* of the string setters. 'copy' copied the actual string, 'set' just
* stored the pointer. In libarchive 2.4 and later, strings are
* always copied.
*/
__LA_DECL void archive_entry_set_atime(struct archive_entry *, time_t, long);
__LA_DECL void archive_entry_unset_atime(struct archive_entry *);
#if defined(_WIN32) && !defined(__CYGWIN__)
__LA_DECL void archive_entry_copy_bhfi(struct archive_entry *, BY_HANDLE_FILE_INFORMATION *);
#endif
__LA_DECL void archive_entry_set_birthtime(struct archive_entry *, time_t, long);
__LA_DECL void archive_entry_unset_birthtime(struct archive_entry *);
__LA_DECL void archive_entry_set_ctime(struct archive_entry *, time_t, long);
__LA_DECL void archive_entry_unset_ctime(struct archive_entry *);
__LA_DECL void archive_entry_set_dev(struct archive_entry *, dev_t);
__LA_DECL void archive_entry_set_devmajor(struct archive_entry *, dev_t);
__LA_DECL void archive_entry_set_devminor(struct archive_entry *, dev_t);
__LA_DECL void archive_entry_set_filetype(struct archive_entry *, unsigned int);
__LA_DECL void archive_entry_set_fflags(struct archive_entry *,
unsigned long /* set */, unsigned long /* clear */);
/* Returns pointer to start of first invalid token, or NULL if none. */
/* Note that all recognized tokens are processed, regardless. */
__LA_DECL const char *archive_entry_copy_fflags_text(struct archive_entry *,
const char *);
__LA_DECL const wchar_t *archive_entry_copy_fflags_text_w(struct archive_entry *,
const wchar_t *);
__LA_DECL void archive_entry_set_gid(struct archive_entry *, la_int64_t);
__LA_DECL void archive_entry_set_gname(struct archive_entry *, const char *);
__LA_DECL void archive_entry_set_gname_utf8(struct archive_entry *, const char *);
__LA_DECL void archive_entry_copy_gname(struct archive_entry *, const char *);
__LA_DECL void archive_entry_copy_gname_w(struct archive_entry *, const wchar_t *);
__LA_DECL int archive_entry_update_gname_utf8(struct archive_entry *, const char *);
__LA_DECL void archive_entry_set_hardlink(struct archive_entry *, const char *);
__LA_DECL void archive_entry_set_hardlink_utf8(struct archive_entry *, const char *);
__LA_DECL void archive_entry_copy_hardlink(struct archive_entry *, const char *);
__LA_DECL void archive_entry_copy_hardlink_w(struct archive_entry *, const wchar_t *);
__LA_DECL int archive_entry_update_hardlink_utf8(struct archive_entry *, const char *);
__LA_DECL void archive_entry_set_ino(struct archive_entry *, la_int64_t);
__LA_DECL void archive_entry_set_ino64(struct archive_entry *, la_int64_t);
__LA_DECL void archive_entry_set_link(struct archive_entry *, const char *);
__LA_DECL void archive_entry_set_link_utf8(struct archive_entry *, const char *);
__LA_DECL void archive_entry_copy_link(struct archive_entry *, const char *);
__LA_DECL void archive_entry_copy_link_w(struct archive_entry *, const wchar_t *);
__LA_DECL int archive_entry_update_link_utf8(struct archive_entry *, const char *);
__LA_DECL void archive_entry_set_mode(struct archive_entry *, __LA_MODE_T);
__LA_DECL void archive_entry_set_mtime(struct archive_entry *, time_t, long);
__LA_DECL void archive_entry_unset_mtime(struct archive_entry *);
__LA_DECL void archive_entry_set_nlink(struct archive_entry *, unsigned int);
__LA_DECL void archive_entry_set_pathname(struct archive_entry *, const char *);
__LA_DECL void archive_entry_set_pathname_utf8(struct archive_entry *, const char *);
__LA_DECL void archive_entry_copy_pathname(struct archive_entry *, const char *);
__LA_DECL void archive_entry_copy_pathname_w(struct archive_entry *, const wchar_t *);
__LA_DECL int archive_entry_update_pathname_utf8(struct archive_entry *, const char *);
__LA_DECL void archive_entry_set_perm(struct archive_entry *, __LA_MODE_T);
__LA_DECL void archive_entry_set_rdev(struct archive_entry *, dev_t);
__LA_DECL void archive_entry_set_rdevmajor(struct archive_entry *, dev_t);
__LA_DECL void archive_entry_set_rdevminor(struct archive_entry *, dev_t);
__LA_DECL void archive_entry_set_size(struct archive_entry *, la_int64_t);
__LA_DECL void archive_entry_unset_size(struct archive_entry *);
__LA_DECL void archive_entry_copy_sourcepath(struct archive_entry *, const char *);
__LA_DECL void archive_entry_copy_sourcepath_w(struct archive_entry *, const wchar_t *);
__LA_DECL void archive_entry_set_symlink(struct archive_entry *, const char *);
__LA_DECL void archive_entry_set_symlink_type(struct archive_entry *, int);
__LA_DECL void archive_entry_set_symlink_utf8(struct archive_entry *, const char *);
__LA_DECL void archive_entry_copy_symlink(struct archive_entry *, const char *);
__LA_DECL void archive_entry_copy_symlink_w(struct archive_entry *, const wchar_t *);
__LA_DECL int archive_entry_update_symlink_utf8(struct archive_entry *, const char *);
__LA_DECL void archive_entry_set_uid(struct archive_entry *, la_int64_t);
__LA_DECL void archive_entry_set_uname(struct archive_entry *, const char *);
__LA_DECL void archive_entry_set_uname_utf8(struct archive_entry *, const char *);
__LA_DECL void archive_entry_copy_uname(struct archive_entry *, const char *);
__LA_DECL void archive_entry_copy_uname_w(struct archive_entry *, const wchar_t *);
__LA_DECL int archive_entry_update_uname_utf8(struct archive_entry *, const char *);
__LA_DECL void archive_entry_set_is_data_encrypted(struct archive_entry *, char is_encrypted);
__LA_DECL void archive_entry_set_is_metadata_encrypted(struct archive_entry *, char is_encrypted);
/*
* Routines to bulk copy fields to/from a platform-native "struct
* stat." Libarchive used to just store a struct stat inside of each
* archive_entry object, but this created issues when trying to
* manipulate archives on systems different than the ones they were
* created on.
*
* TODO: On Linux and other LFS systems, provide both stat32 and
* stat64 versions of these functions and all of the macro glue so
* that archive_entry_stat is magically defined to
* archive_entry_stat32 or archive_entry_stat64 as appropriate.
*/
__LA_DECL const struct stat *archive_entry_stat(struct archive_entry *);
__LA_DECL void archive_entry_copy_stat(struct archive_entry *, const struct stat *);
/*
* Storage for Mac OS-specific AppleDouble metadata information.
* Apple-format tar files store a separate binary blob containing
* encoded metadata with ACL, extended attributes, etc.
* This provides a place to store that blob.
*/
__LA_DECL const void * archive_entry_mac_metadata(struct archive_entry *, size_t *);
__LA_DECL void archive_entry_copy_mac_metadata(struct archive_entry *, const void *, size_t);
/*
* ACL routines. This used to simply store and return text-format ACL
* strings, but that proved insufficient for a number of reasons:
* = clients need control over uname/uid and gname/gid mappings
* = there are many different ACL text formats
* = would like to be able to read/convert archives containing ACLs
* on platforms that lack ACL libraries
*
* This last point, in particular, forces me to implement a reasonably
* complete set of ACL support routines.
*/
/*
* Permission bits.
*/
#define ARCHIVE_ENTRY_ACL_EXECUTE 0x00000001
#define ARCHIVE_ENTRY_ACL_WRITE 0x00000002
#define ARCHIVE_ENTRY_ACL_READ 0x00000004
#define ARCHIVE_ENTRY_ACL_READ_DATA 0x00000008
#define ARCHIVE_ENTRY_ACL_LIST_DIRECTORY 0x00000008
#define ARCHIVE_ENTRY_ACL_WRITE_DATA 0x00000010
#define ARCHIVE_ENTRY_ACL_ADD_FILE 0x00000010
#define ARCHIVE_ENTRY_ACL_APPEND_DATA 0x00000020
#define ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY 0x00000020
#define ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS 0x00000040
#define ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS 0x00000080
#define ARCHIVE_ENTRY_ACL_DELETE_CHILD 0x00000100
#define ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES 0x00000200
#define ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES 0x00000400
#define ARCHIVE_ENTRY_ACL_DELETE 0x00000800
#define ARCHIVE_ENTRY_ACL_READ_ACL 0x00001000
#define ARCHIVE_ENTRY_ACL_WRITE_ACL 0x00002000
#define ARCHIVE_ENTRY_ACL_WRITE_OWNER 0x00004000
#define ARCHIVE_ENTRY_ACL_SYNCHRONIZE 0x00008000
#define ARCHIVE_ENTRY_ACL_PERMS_POSIX1E \
(ARCHIVE_ENTRY_ACL_EXECUTE \
| ARCHIVE_ENTRY_ACL_WRITE \
| ARCHIVE_ENTRY_ACL_READ)
#define ARCHIVE_ENTRY_ACL_PERMS_NFS4 \
(ARCHIVE_ENTRY_ACL_EXECUTE \
| ARCHIVE_ENTRY_ACL_READ_DATA \
| ARCHIVE_ENTRY_ACL_LIST_DIRECTORY \
| ARCHIVE_ENTRY_ACL_WRITE_DATA \
| ARCHIVE_ENTRY_ACL_ADD_FILE \
| ARCHIVE_ENTRY_ACL_APPEND_DATA \
| ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY \
| ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS \
| ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS \
| ARCHIVE_ENTRY_ACL_DELETE_CHILD \
| ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES \
| ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES \
| ARCHIVE_ENTRY_ACL_DELETE \
| ARCHIVE_ENTRY_ACL_READ_ACL \
| ARCHIVE_ENTRY_ACL_WRITE_ACL \
| ARCHIVE_ENTRY_ACL_WRITE_OWNER \
| ARCHIVE_ENTRY_ACL_SYNCHRONIZE)
/*
* Inheritance values (NFS4 ACLs only); included in permset.
*/
#define ARCHIVE_ENTRY_ACL_ENTRY_INHERITED 0x01000000
#define ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT 0x02000000
#define ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT 0x04000000
#define ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT 0x08000000
#define ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY 0x10000000
#define ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS 0x20000000
#define ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS 0x40000000
#define ARCHIVE_ENTRY_ACL_INHERITANCE_NFS4 \
(ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT \
| ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT \
| ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT \
| ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY \
| ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS \
| ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS \
| ARCHIVE_ENTRY_ACL_ENTRY_INHERITED)
/* We need to be able to specify combinations of these. */
#define ARCHIVE_ENTRY_ACL_TYPE_ACCESS 0x00000100 /* POSIX.1e only */
#define ARCHIVE_ENTRY_ACL_TYPE_DEFAULT 0x00000200 /* POSIX.1e only */
#define ARCHIVE_ENTRY_ACL_TYPE_ALLOW 0x00000400 /* NFS4 only */
#define ARCHIVE_ENTRY_ACL_TYPE_DENY 0x00000800 /* NFS4 only */
#define ARCHIVE_ENTRY_ACL_TYPE_AUDIT 0x00001000 /* NFS4 only */
#define ARCHIVE_ENTRY_ACL_TYPE_ALARM 0x00002000 /* NFS4 only */
#define ARCHIVE_ENTRY_ACL_TYPE_POSIX1E (ARCHIVE_ENTRY_ACL_TYPE_ACCESS \
| ARCHIVE_ENTRY_ACL_TYPE_DEFAULT)
#define ARCHIVE_ENTRY_ACL_TYPE_NFS4 (ARCHIVE_ENTRY_ACL_TYPE_ALLOW \
| ARCHIVE_ENTRY_ACL_TYPE_DENY \
| ARCHIVE_ENTRY_ACL_TYPE_AUDIT \
| ARCHIVE_ENTRY_ACL_TYPE_ALARM)
/* Tag values mimic POSIX.1e */
#define ARCHIVE_ENTRY_ACL_USER 10001 /* Specified user. */
#define ARCHIVE_ENTRY_ACL_USER_OBJ 10002 /* User who owns the file. */
#define ARCHIVE_ENTRY_ACL_GROUP 10003 /* Specified group. */
#define ARCHIVE_ENTRY_ACL_GROUP_OBJ 10004 /* Group who owns the file. */
#define ARCHIVE_ENTRY_ACL_MASK 10005 /* Modify group access (POSIX.1e only) */
#define ARCHIVE_ENTRY_ACL_OTHER 10006 /* Public (POSIX.1e only) */
#define ARCHIVE_ENTRY_ACL_EVERYONE 10107 /* Everyone (NFS4 only) */
/*
* Set the ACL by clearing it and adding entries one at a time.
* Unlike the POSIX.1e ACL routines, you must specify the type
* (access/default) for each entry. Internally, the ACL data is just
* a soup of entries. API calls here allow you to retrieve just the
* entries of interest. This design (which goes against the spirit of
* POSIX.1e) is useful for handling archive formats that combine
* default and access information in a single ACL list.
*/
__LA_DECL void archive_entry_acl_clear(struct archive_entry *);
__LA_DECL int archive_entry_acl_add_entry(struct archive_entry *,
int /* type */, int /* permset */, int /* tag */,
int /* qual */, const char * /* name */);
__LA_DECL int archive_entry_acl_add_entry_w(struct archive_entry *,
int /* type */, int /* permset */, int /* tag */,
int /* qual */, const wchar_t * /* name */);
/*
* To retrieve the ACL, first "reset", then repeatedly ask for the
* "next" entry. The want_type parameter allows you to request only
* certain types of entries.
*/
__LA_DECL int archive_entry_acl_reset(struct archive_entry *, int /* want_type */);
__LA_DECL int archive_entry_acl_next(struct archive_entry *, int /* want_type */,
int * /* type */, int * /* permset */, int * /* tag */,
int * /* qual */, const char ** /* name */);
/*
* Construct a text-format ACL. The flags argument is a bitmask that
* can include any of the following:
*
* Flags only for archive entries with POSIX.1e ACL:
* ARCHIVE_ENTRY_ACL_TYPE_ACCESS - Include POSIX.1e "access" entries.
* ARCHIVE_ENTRY_ACL_TYPE_DEFAULT - Include POSIX.1e "default" entries.
* ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT - Include "default:" before each
* default ACL entry.
* ARCHIVE_ENTRY_ACL_STYLE_SOLARIS - Output only one colon after "other" and
* "mask" entries.
*
* Flags only for archive entries with NFSv4 ACL:
* ARCHIVE_ENTRY_ACL_STYLE_COMPACT - Do not output the minus character for
* unset permissions and flags in NFSv4 ACL permission and flag fields
*
* Flags for for archive entries with POSIX.1e ACL or NFSv4 ACL:
* ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID - Include extra numeric ID field in
* each ACL entry.
* ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA - Separate entries with comma
* instead of newline.
*/
#define ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID 0x00000001
#define ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 0x00000002
#define ARCHIVE_ENTRY_ACL_STYLE_SOLARIS 0x00000004
#define ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA 0x00000008
#define ARCHIVE_ENTRY_ACL_STYLE_COMPACT 0x00000010
__LA_DECL wchar_t *archive_entry_acl_to_text_w(struct archive_entry *,
la_ssize_t * /* len */, int /* flags */);
__LA_DECL char *archive_entry_acl_to_text(struct archive_entry *,
la_ssize_t * /* len */, int /* flags */);
__LA_DECL int archive_entry_acl_from_text_w(struct archive_entry *,
const wchar_t * /* wtext */, int /* type */);
__LA_DECL int archive_entry_acl_from_text(struct archive_entry *,
const char * /* text */, int /* type */);
/* Deprecated constants */
#define OLD_ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID 1024
#define OLD_ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 2048
/* Deprecated functions */
__LA_DECL const wchar_t *archive_entry_acl_text_w(struct archive_entry *,
int /* flags */) __LA_DEPRECATED;
__LA_DECL const char *archive_entry_acl_text(struct archive_entry *,
int /* flags */) __LA_DEPRECATED;
/* Return bitmask of ACL types in an archive entry */
__LA_DECL int archive_entry_acl_types(struct archive_entry *);
/* Return a count of entries matching 'want_type' */
__LA_DECL int archive_entry_acl_count(struct archive_entry *, int /* want_type */);
/* Return an opaque ACL object. */
/* There's not yet anything clients can actually do with this... */
struct archive_acl;
__LA_DECL struct archive_acl *archive_entry_acl(struct archive_entry *);
/*
* extended attributes
*/
__LA_DECL void archive_entry_xattr_clear(struct archive_entry *);
__LA_DECL void archive_entry_xattr_add_entry(struct archive_entry *,
const char * /* name */, const void * /* value */,
size_t /* size */);
/*
* To retrieve the xattr list, first "reset", then repeatedly ask for the
* "next" entry.
*/
__LA_DECL int archive_entry_xattr_count(struct archive_entry *);
__LA_DECL int archive_entry_xattr_reset(struct archive_entry *);
__LA_DECL int archive_entry_xattr_next(struct archive_entry *,
const char ** /* name */, const void ** /* value */, size_t *);
/*
* sparse
*/
__LA_DECL void archive_entry_sparse_clear(struct archive_entry *);
__LA_DECL void archive_entry_sparse_add_entry(struct archive_entry *,
la_int64_t /* offset */, la_int64_t /* length */);
/*
* To retrieve the xattr list, first "reset", then repeatedly ask for the
* "next" entry.
*/
__LA_DECL int archive_entry_sparse_count(struct archive_entry *);
__LA_DECL int archive_entry_sparse_reset(struct archive_entry *);
__LA_DECL int archive_entry_sparse_next(struct archive_entry *,
la_int64_t * /* offset */, la_int64_t * /* length */);
/*
* Utility to match up hardlinks.
*
* The 'struct archive_entry_linkresolver' is a cache of archive entries
* for files with multiple links. Here's how to use it:
* 1. Create a lookup object with archive_entry_linkresolver_new()
* 2. Tell it the archive format you're using.
* 3. Hand each archive_entry to archive_entry_linkify().
* That function will return 0, 1, or 2 entries that should
* be written.
* 4. Call archive_entry_linkify(resolver, NULL) until
* no more entries are returned.
* 5. Call archive_entry_linkresolver_free(resolver) to free resources.
*
* The entries returned have their hardlink and size fields updated
* appropriately. If an entry is passed in that does not refer to
* a file with multiple links, it is returned unchanged. The intention
* is that you should be able to simply filter all entries through
* this machine.
*
* To make things more efficient, be sure that each entry has a valid
* nlinks value. The hardlink cache uses this to track when all links
* have been found. If the nlinks value is zero, it will keep every
* name in the cache indefinitely, which can use a lot of memory.
*
* Note that archive_entry_size() is reset to zero if the file
* body should not be written to the archive. Pay attention!
*/
struct archive_entry_linkresolver;
/*
* There are three different strategies for marking hardlinks.
* The descriptions below name them after the best-known
* formats that rely on each strategy:
*
* "Old cpio" is the simplest, it always returns any entry unmodified.
* As far as I know, only cpio formats use this. Old cpio archives
* store every link with the full body; the onus is on the dearchiver
* to detect and properly link the files as they are restored.
* "tar" is also pretty simple; it caches a copy the first time it sees
* any link. Subsequent appearances are modified to be hardlink
* references to the first one without any body. Used by all tar
* formats, although the newest tar formats permit the "old cpio" strategy
* as well. This strategy is very simple for the dearchiver,
* and reasonably straightforward for the archiver.
* "new cpio" is trickier. It stores the body only with the last
* occurrence. The complication is that we might not
* see every link to a particular file in a single session, so
* there's no easy way to know when we've seen the last occurrence.
* The solution here is to queue one link until we see the next.
* At the end of the session, you can enumerate any remaining
* entries by calling archive_entry_linkify(NULL) and store those
* bodies. If you have a file with three links l1, l2, and l3,
* you'll get the following behavior if you see all three links:
* linkify(l1) => NULL (the resolver stores l1 internally)
* linkify(l2) => l1 (resolver stores l2, you write l1)
* linkify(l3) => l2, l3 (all links seen, you can write both).
* If you only see l1 and l2, you'll get this behavior:
* linkify(l1) => NULL
* linkify(l2) => l1
* linkify(NULL) => l2 (at end, you retrieve remaining links)
* As the name suggests, this strategy is used by newer cpio variants.
* It's noticeably more complex for the archiver, slightly more complex
* for the dearchiver than the tar strategy, but makes it straightforward
* to restore a file using any link by simply continuing to scan until
* you see a link that is stored with a body. In contrast, the tar
* strategy requires you to rescan the archive from the beginning to
* correctly extract an arbitrary link.
*/
__LA_DECL struct archive_entry_linkresolver *archive_entry_linkresolver_new(void);
__LA_DECL void archive_entry_linkresolver_set_strategy(
struct archive_entry_linkresolver *, int /* format_code */);
__LA_DECL void archive_entry_linkresolver_free(struct archive_entry_linkresolver *);
__LA_DECL void archive_entry_linkify(struct archive_entry_linkresolver *,
struct archive_entry **, struct archive_entry **);
__LA_DECL struct archive_entry *archive_entry_partial_links(
struct archive_entry_linkresolver *res, unsigned int *links);
#ifdef __cplusplus
}
#endif
/* This is meaningless outside of this header. */
#undef __LA_DECL
#endif /* !ARCHIVE_ENTRY_H_INCLUDED */

View File

@ -1,75 +0,0 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
__FBSDID("$FreeBSD$");
#include "archive_private.h"
#include "archive_entry.h"
#if defined(_WIN32) && !defined(__CYGWIN__)
#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
__inline static void
fileTimeToUtc(const FILETIME *filetime, time_t *t, long *ns)
{
ULARGE_INTEGER utc;
utc.HighPart = filetime->dwHighDateTime;
utc.LowPart = filetime->dwLowDateTime;
if (utc.QuadPart >= EPOC_TIME) {
utc.QuadPart -= EPOC_TIME;
*t = (time_t)(utc.QuadPart / 10000000); /* milli seconds base */
*ns = (long)(utc.QuadPart % 10000000) * 100;/* nano seconds base */
} else {
*t = 0;
*ns = 0;
}
}
void
archive_entry_copy_bhfi(struct archive_entry *entry,
BY_HANDLE_FILE_INFORMATION *bhfi)
{
time_t secs;
long nsecs;
fileTimeToUtc(&bhfi->ftLastAccessTime, &secs, &nsecs);
archive_entry_set_atime(entry, secs, nsecs);
fileTimeToUtc(&bhfi->ftLastWriteTime, &secs, &nsecs);
archive_entry_set_mtime(entry, secs, nsecs);
fileTimeToUtc(&bhfi->ftCreationTime, &secs, &nsecs);
archive_entry_set_birthtime(entry, secs, nsecs);
archive_entry_set_ctime(entry, secs, nsecs);
archive_entry_set_dev(entry, bhfi->dwVolumeSerialNumber);
archive_entry_set_ino64(entry, (((int64_t)bhfi->nFileIndexHigh) << 32)
+ bhfi->nFileIndexLow);
archive_entry_set_nlink(entry, bhfi->nNumberOfLinks);
archive_entry_set_size(entry, (((int64_t)bhfi->nFileSizeHigh) << 32)
+ bhfi->nFileSizeLow);
/* archive_entry_set_mode(entry, st->st_mode); */
}
#endif

View File

@ -1,83 +0,0 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_copy_stat.c 189466 2009-03-07 00:52:02Z kientzle $");
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include "archive.h"
#include "archive_entry.h"
void
archive_entry_copy_stat(struct archive_entry *entry, const struct stat *st)
{
#if HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
archive_entry_set_atime(entry, st->st_atime, st->st_atimespec.tv_nsec);
archive_entry_set_ctime(entry, st->st_ctime, st->st_ctimespec.tv_nsec);
archive_entry_set_mtime(entry, st->st_mtime, st->st_mtimespec.tv_nsec);
#elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
archive_entry_set_atime(entry, st->st_atime, st->st_atim.tv_nsec);
archive_entry_set_ctime(entry, st->st_ctime, st->st_ctim.tv_nsec);
archive_entry_set_mtime(entry, st->st_mtime, st->st_mtim.tv_nsec);
#elif HAVE_STRUCT_STAT_ST_MTIME_NSEC
archive_entry_set_atime(entry, st->st_atime, st->st_atime_nsec);
archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_nsec);
archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_nsec);
#elif HAVE_STRUCT_STAT_ST_MTIME_N
archive_entry_set_atime(entry, st->st_atime, st->st_atime_n);
archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_n);
archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_n);
#elif HAVE_STRUCT_STAT_ST_UMTIME
archive_entry_set_atime(entry, st->st_atime, st->st_uatime * 1000);
archive_entry_set_ctime(entry, st->st_ctime, st->st_uctime * 1000);
archive_entry_set_mtime(entry, st->st_mtime, st->st_umtime * 1000);
#elif HAVE_STRUCT_STAT_ST_MTIME_USEC
archive_entry_set_atime(entry, st->st_atime, st->st_atime_usec * 1000);
archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_usec * 1000);
archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_usec * 1000);
#else
archive_entry_set_atime(entry, st->st_atime, 0);
archive_entry_set_ctime(entry, st->st_ctime, 0);
archive_entry_set_mtime(entry, st->st_mtime, 0);
#endif
#if HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
archive_entry_set_birthtime(entry, st->st_birthtime, st->st_birthtimespec.tv_nsec);
#elif HAVE_STRUCT_STAT_ST_BIRTHTIME
archive_entry_set_birthtime(entry, st->st_birthtime, 0);
#else
archive_entry_unset_birthtime(entry);
#endif
archive_entry_set_dev(entry, st->st_dev);
archive_entry_set_gid(entry, st->st_gid);
archive_entry_set_uid(entry, st->st_uid);
archive_entry_set_ino(entry, st->st_ino);
archive_entry_set_nlink(entry, st->st_nlink);
archive_entry_set_rdev(entry, st->st_rdev);
archive_entry_set_size(entry, st->st_size);
archive_entry_set_mode(entry, st->st_mode);
}

View File

@ -1,447 +0,0 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_link_resolver.c 201100 2009-12-28 03:05:31Z kientzle $");
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "archive.h"
#include "archive_entry.h"
/*
* This is mostly a pretty straightforward hash table implementation.
* The only interesting bit is the different strategies used to
* match up links. These strategies match those used by various
* archiving formats:
* tar - content stored with first link, remainder refer back to it.
* This requires us to match each subsequent link up with the
* first appearance.
* cpio - Old cpio just stored body with each link, match-ups were
* implicit. This is trivial.
* new cpio - New cpio only stores body with last link, match-ups
* are implicit. This is actually quite tricky; see the notes
* below.
*/
/* Users pass us a format code, we translate that into a strategy here. */
#define ARCHIVE_ENTRY_LINKIFY_LIKE_TAR 0
#define ARCHIVE_ENTRY_LINKIFY_LIKE_MTREE 1
#define ARCHIVE_ENTRY_LINKIFY_LIKE_OLD_CPIO 2
#define ARCHIVE_ENTRY_LINKIFY_LIKE_NEW_CPIO 3
/* Initial size of link cache. */
#define links_cache_initial_size 1024
struct links_entry {
struct links_entry *next;
struct links_entry *previous;
struct archive_entry *canonical;
struct archive_entry *entry;
size_t hash;
unsigned int links; /* # links not yet seen */
};
struct archive_entry_linkresolver {
struct links_entry **buckets;
struct links_entry *spare;
unsigned long number_entries;
size_t number_buckets;
int strategy;
};
#define NEXT_ENTRY_DEFERRED 1
#define NEXT_ENTRY_PARTIAL 2
#define NEXT_ENTRY_ALL (NEXT_ENTRY_DEFERRED | NEXT_ENTRY_PARTIAL)
static struct links_entry *find_entry(struct archive_entry_linkresolver *,
struct archive_entry *);
static void grow_hash(struct archive_entry_linkresolver *);
static struct links_entry *insert_entry(struct archive_entry_linkresolver *,
struct archive_entry *);
static struct links_entry *next_entry(struct archive_entry_linkresolver *,
int);
struct archive_entry_linkresolver *
archive_entry_linkresolver_new(void)
{
struct archive_entry_linkresolver *res;
/* Check for positive power-of-two */
if (links_cache_initial_size == 0 ||
(links_cache_initial_size & (links_cache_initial_size - 1)) != 0)
return (NULL);
res = calloc(1, sizeof(struct archive_entry_linkresolver));
if (res == NULL)
return (NULL);
res->number_buckets = links_cache_initial_size;
res->buckets = calloc(res->number_buckets, sizeof(res->buckets[0]));
if (res->buckets == NULL) {
free(res);
return (NULL);
}
return (res);
}
void
archive_entry_linkresolver_set_strategy(struct archive_entry_linkresolver *res,
int fmt)
{
int fmtbase = fmt & ARCHIVE_FORMAT_BASE_MASK;
switch (fmtbase) {
case ARCHIVE_FORMAT_7ZIP:
case ARCHIVE_FORMAT_AR:
case ARCHIVE_FORMAT_ZIP:
res->strategy = ARCHIVE_ENTRY_LINKIFY_LIKE_OLD_CPIO;
break;
case ARCHIVE_FORMAT_CPIO:
switch (fmt) {
case ARCHIVE_FORMAT_CPIO_SVR4_NOCRC:
case ARCHIVE_FORMAT_CPIO_SVR4_CRC:
res->strategy = ARCHIVE_ENTRY_LINKIFY_LIKE_NEW_CPIO;
break;
default:
res->strategy = ARCHIVE_ENTRY_LINKIFY_LIKE_OLD_CPIO;
break;
}
break;
case ARCHIVE_FORMAT_MTREE:
res->strategy = ARCHIVE_ENTRY_LINKIFY_LIKE_MTREE;
break;
case ARCHIVE_FORMAT_ISO9660:
case ARCHIVE_FORMAT_SHAR:
case ARCHIVE_FORMAT_TAR:
case ARCHIVE_FORMAT_XAR:
res->strategy = ARCHIVE_ENTRY_LINKIFY_LIKE_TAR;
break;
default:
res->strategy = ARCHIVE_ENTRY_LINKIFY_LIKE_OLD_CPIO;
break;
}
}
void
archive_entry_linkresolver_free(struct archive_entry_linkresolver *res)
{
struct links_entry *le;
if (res == NULL)
return;
while ((le = next_entry(res, NEXT_ENTRY_ALL)) != NULL)
archive_entry_free(le->entry);
free(res->buckets);
free(res);
}
void
archive_entry_linkify(struct archive_entry_linkresolver *res,
struct archive_entry **e, struct archive_entry **f)
{
struct links_entry *le;
struct archive_entry *t;
*f = NULL; /* Default: Don't return a second entry. */
if (*e == NULL) {
le = next_entry(res, NEXT_ENTRY_DEFERRED);
if (le != NULL) {
*e = le->entry;
le->entry = NULL;
}
return;
}
/* If it has only one link, then we're done. */
if (archive_entry_nlink(*e) == 1)
return;
/* Directories, devices never have hardlinks. */
if (archive_entry_filetype(*e) == AE_IFDIR
|| archive_entry_filetype(*e) == AE_IFBLK
|| archive_entry_filetype(*e) == AE_IFCHR)
return;
switch (res->strategy) {
case ARCHIVE_ENTRY_LINKIFY_LIKE_TAR:
le = find_entry(res, *e);
if (le != NULL) {
archive_entry_unset_size(*e);
archive_entry_copy_hardlink(*e,
archive_entry_pathname(le->canonical));
} else
insert_entry(res, *e);
return;
case ARCHIVE_ENTRY_LINKIFY_LIKE_MTREE:
le = find_entry(res, *e);
if (le != NULL) {
archive_entry_copy_hardlink(*e,
archive_entry_pathname(le->canonical));
} else
insert_entry(res, *e);
return;
case ARCHIVE_ENTRY_LINKIFY_LIKE_OLD_CPIO:
/* This one is trivial. */
return;
case ARCHIVE_ENTRY_LINKIFY_LIKE_NEW_CPIO:
le = find_entry(res, *e);
if (le != NULL) {
/*
* Put the new entry in le, return the
* old entry from le.
*/
t = *e;
*e = le->entry;
le->entry = t;
/* Make the old entry into a hardlink. */
archive_entry_unset_size(*e);
archive_entry_copy_hardlink(*e,
archive_entry_pathname(le->canonical));
/* If we ran out of links, return the
* final entry as well. */
if (le->links == 0) {
*f = le->entry;
le->entry = NULL;
}
} else {
/*
* If we haven't seen it, tuck it away
* for future use.
*/
le = insert_entry(res, *e);
if (le == NULL)
/* XXX We should return an error code XXX */
return;
le->entry = *e;
*e = NULL;
}
return;
default:
break;
}
return;
}
static struct links_entry *
find_entry(struct archive_entry_linkresolver *res,
struct archive_entry *entry)
{
struct links_entry *le;
size_t hash, bucket;
dev_t dev;
int64_t ino;
/* Free a held entry. */
if (res->spare != NULL) {
archive_entry_free(res->spare->canonical);
archive_entry_free(res->spare->entry);
free(res->spare);
res->spare = NULL;
}
dev = archive_entry_dev(entry);
ino = archive_entry_ino64(entry);
hash = (size_t)(dev ^ ino);
/* Try to locate this entry in the links cache. */
bucket = hash & (res->number_buckets - 1);
for (le = res->buckets[bucket]; le != NULL; le = le->next) {
if (le->hash == hash
&& dev == archive_entry_dev(le->canonical)
&& ino == archive_entry_ino64(le->canonical)) {
/*
* Decrement link count each time and release
* the entry if it hits zero. This saves
* memory and is necessary for detecting
* missed links.
*/
--le->links;
if (le->links > 0)
return (le);
/* Remove it from this hash bucket. */
if (le->previous != NULL)
le->previous->next = le->next;
if (le->next != NULL)
le->next->previous = le->previous;
if (res->buckets[bucket] == le)
res->buckets[bucket] = le->next;
res->number_entries--;
/* Defer freeing this entry. */
res->spare = le;
return (le);
}
}
return (NULL);
}
static struct links_entry *
next_entry(struct archive_entry_linkresolver *res, int mode)
{
struct links_entry *le;
size_t bucket;
/* Free a held entry. */
if (res->spare != NULL) {
archive_entry_free(res->spare->canonical);
archive_entry_free(res->spare->entry);
free(res->spare);
res->spare = NULL;
}
/* Look for next non-empty bucket in the links cache. */
for (bucket = 0; bucket < res->number_buckets; bucket++) {
for (le = res->buckets[bucket]; le != NULL; le = le->next) {
if (le->entry != NULL &&
(mode & NEXT_ENTRY_DEFERRED) == 0)
continue;
if (le->entry == NULL &&
(mode & NEXT_ENTRY_PARTIAL) == 0)
continue;
/* Remove it from this hash bucket. */
if (le->next != NULL)
le->next->previous = le->previous;
if (le->previous != NULL)
le->previous->next = le->next;
else
res->buckets[bucket] = le->next;
res->number_entries--;
/* Defer freeing this entry. */
res->spare = le;
return (le);
}
}
return (NULL);
}
static struct links_entry *
insert_entry(struct archive_entry_linkresolver *res,
struct archive_entry *entry)
{
struct links_entry *le;
size_t hash, bucket;
/* Add this entry to the links cache. */
le = calloc(1, sizeof(struct links_entry));
if (le == NULL)
return (NULL);
le->canonical = archive_entry_clone(entry);
/* If the links cache is getting too full, enlarge the hash table. */
if (res->number_entries > res->number_buckets * 2)
grow_hash(res);
hash = (size_t)(archive_entry_dev(entry) ^ archive_entry_ino64(entry));
bucket = hash & (res->number_buckets - 1);
/* If we could allocate the entry, record it. */
if (res->buckets[bucket] != NULL)
res->buckets[bucket]->previous = le;
res->number_entries++;
le->next = res->buckets[bucket];
le->previous = NULL;
res->buckets[bucket] = le;
le->hash = hash;
le->links = archive_entry_nlink(entry) - 1;
return (le);
}
static void
grow_hash(struct archive_entry_linkresolver *res)
{
struct links_entry *le, **new_buckets;
size_t new_size;
size_t i, bucket;
/* Try to enlarge the bucket list. */
new_size = res->number_buckets * 2;
if (new_size < res->number_buckets)
return;
new_buckets = calloc(new_size, sizeof(struct links_entry *));
if (new_buckets == NULL)
return;
for (i = 0; i < res->number_buckets; i++) {
while (res->buckets[i] != NULL) {
/* Remove entry from old bucket. */
le = res->buckets[i];
res->buckets[i] = le->next;
/* Add entry to new bucket. */
bucket = le->hash & (new_size - 1);
if (new_buckets[bucket] != NULL)
new_buckets[bucket]->previous = le;
le->next = new_buckets[bucket];
le->previous = NULL;
new_buckets[bucket] = le;
}
}
free(res->buckets);
res->buckets = new_buckets;
res->number_buckets = new_size;
}
struct archive_entry *
archive_entry_partial_links(struct archive_entry_linkresolver *res,
unsigned int *links)
{
struct archive_entry *e;
struct links_entry *le;
/* Free a held entry. */
if (res->spare != NULL) {
archive_entry_free(res->spare->canonical);
archive_entry_free(res->spare->entry);
free(res->spare);
res->spare = NULL;
}
le = next_entry(res, NEXT_ENTRY_PARTIAL);
if (le != NULL) {
e = le->canonical;
if (links != NULL)
*links = le->links;
le->canonical = NULL;
} else {
e = NULL;
if (links != NULL)
*links = 0;
}
return (e);
}

View File

@ -1,92 +0,0 @@
/*-
* Copyright (c) 2011 Michihiro NAKAJIMA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef ARCHIVE_ENTRY_LOCALE_H_INCLUDED
#define ARCHIVE_ENTRY_LOCALE_H_INCLUDED
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
struct archive_entry;
struct archive_string_conv;
/*
* Utility functions to set and get entry attributes by translating
* character-set. These are designed for use in format readers and writers.
*
* The return code and interface of these are quite different from other
* functions for archive_entry defined in archive_entry.h.
* Common return code are:
* Return 0 if the string conversion succeeded.
* Return -1 if the string conversion failed.
*/
#define archive_entry_gname_l _archive_entry_gname_l
int _archive_entry_gname_l(struct archive_entry *,
const char **, size_t *, struct archive_string_conv *);
#define archive_entry_hardlink_l _archive_entry_hardlink_l
int _archive_entry_hardlink_l(struct archive_entry *,
const char **, size_t *, struct archive_string_conv *);
#define archive_entry_pathname_l _archive_entry_pathname_l
int _archive_entry_pathname_l(struct archive_entry *,
const char **, size_t *, struct archive_string_conv *);
#define archive_entry_symlink_l _archive_entry_symlink_l
int _archive_entry_symlink_l(struct archive_entry *,
const char **, size_t *, struct archive_string_conv *);
#define archive_entry_uname_l _archive_entry_uname_l
int _archive_entry_uname_l(struct archive_entry *,
const char **, size_t *, struct archive_string_conv *);
#define archive_entry_acl_text_l _archive_entry_acl_text_l
int _archive_entry_acl_text_l(struct archive_entry *, int,
const char **, size_t *, struct archive_string_conv *) __LA_DEPRECATED;
#define archive_entry_acl_to_text_l _archive_entry_acl_to_text_l
char *_archive_entry_acl_to_text_l(struct archive_entry *, ssize_t *, int,
struct archive_string_conv *);
#define archive_entry_acl_from_text_l _archive_entry_acl_from_text_l
int _archive_entry_acl_from_text_l(struct archive_entry *, const char* text,
int type, struct archive_string_conv *);
#define archive_entry_copy_gname_l _archive_entry_copy_gname_l
int _archive_entry_copy_gname_l(struct archive_entry *,
const char *, size_t, struct archive_string_conv *);
#define archive_entry_copy_hardlink_l _archive_entry_copy_hardlink_l
int _archive_entry_copy_hardlink_l(struct archive_entry *,
const char *, size_t, struct archive_string_conv *);
#define archive_entry_copy_link_l _archive_entry_copy_link_l
int _archive_entry_copy_link_l(struct archive_entry *,
const char *, size_t, struct archive_string_conv *);
#define archive_entry_copy_pathname_l _archive_entry_copy_pathname_l
int _archive_entry_copy_pathname_l(struct archive_entry *,
const char *, size_t, struct archive_string_conv *);
#define archive_entry_copy_symlink_l _archive_entry_copy_symlink_l
int _archive_entry_copy_symlink_l(struct archive_entry *,
const char *, size_t, struct archive_string_conv *);
#define archive_entry_copy_uname_l _archive_entry_copy_uname_l
int _archive_entry_copy_uname_l(struct archive_entry *,
const char *, size_t, struct archive_string_conv *);
#endif /* ARCHIVE_ENTRY_LOCALE_H_INCLUDED */

View File

@ -1,184 +0,0 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: head/lib/libarchive/archive_entry_private.h 201096 2009-12-28 02:41:27Z kientzle $
*/
#ifndef ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
#define ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
#include "archive_acl_private.h"
#include "archive_string.h"
struct ae_xattr {
struct ae_xattr *next;
char *name;
void *value;
size_t size;
};
struct ae_sparse {
struct ae_sparse *next;
int64_t offset;
int64_t length;
};
/*
* Description of an archive entry.
*
* Basically, this is a "struct stat" with a few text fields added in.
*
* TODO: Add "comment", "charset", and possibly other entries
* that are supported by "pax interchange" format. However, GNU, ustar,
* cpio, and other variants don't support these features, so they're not an
* excruciatingly high priority right now.
*
* TODO: "pax interchange" format allows essentially arbitrary
* key/value attributes to be attached to any entry. Supporting
* such extensions may make this library useful for special
* applications (e.g., a package manager could attach special
* package-management attributes to each entry). There are tricky
* API issues involved, so this is not going to happen until
* there's a real demand for it.
*
* TODO: Design a good API for handling sparse files.
*/
struct archive_entry {
struct archive *archive;
/*
* Note that ae_stat.st_mode & AE_IFMT can be 0!
*
* This occurs when the actual file type of the object is not
* in the archive. For example, 'tar' archives store
* hardlinks without marking the type of the underlying
* object.
*/
/*
* We have a "struct aest" for holding file metadata rather than just
* a "struct stat" because on some platforms the "struct stat" has
* fields which are too narrow to hold the range of possible values;
* we don't want to lose information if we read an archive and write
* out another (e.g., in "tar -cf new.tar @old.tar").
*
* The "stat" pointer points to some form of platform-specific struct
* stat; it is declared as a void * rather than a struct stat * as
* some platforms have multiple varieties of stat structures.
*/
void *stat;
int stat_valid; /* Set to 0 whenever a field in aest changes. */
struct aest {
int64_t aest_atime;
uint32_t aest_atime_nsec;
int64_t aest_ctime;
uint32_t aest_ctime_nsec;
int64_t aest_mtime;
uint32_t aest_mtime_nsec;
int64_t aest_birthtime;
uint32_t aest_birthtime_nsec;
int64_t aest_gid;
int64_t aest_ino;
uint32_t aest_nlink;
uint64_t aest_size;
int64_t aest_uid;
/*
* Because converting between device codes and
* major/minor values is platform-specific and
* inherently a bit risky, we only do that conversion
* lazily. That way, we will do a better job of
* preserving information in those cases where no
* conversion is actually required.
*/
int aest_dev_is_broken_down;
dev_t aest_dev;
dev_t aest_devmajor;
dev_t aest_devminor;
int aest_rdev_is_broken_down;
dev_t aest_rdev;
dev_t aest_rdevmajor;
dev_t aest_rdevminor;
} ae_stat;
int ae_set; /* bitmap of fields that are currently set */
#define AE_SET_HARDLINK 1
#define AE_SET_SYMLINK 2
#define AE_SET_ATIME 4
#define AE_SET_CTIME 8
#define AE_SET_MTIME 16
#define AE_SET_BIRTHTIME 32
#define AE_SET_SIZE 64
#define AE_SET_INO 128
#define AE_SET_DEV 256
/*
* Use aes here so that we get transparent mbs<->wcs conversions.
*/
struct archive_mstring ae_fflags_text; /* Text fflags per fflagstostr(3) */
unsigned long ae_fflags_set; /* Bitmap fflags */
unsigned long ae_fflags_clear;
struct archive_mstring ae_gname; /* Name of owning group */
struct archive_mstring ae_hardlink; /* Name of target for hardlink */
struct archive_mstring ae_pathname; /* Name of entry */
struct archive_mstring ae_symlink; /* symlink contents */
struct archive_mstring ae_uname; /* Name of owner */
/* Not used within libarchive; useful for some clients. */
struct archive_mstring ae_sourcepath; /* Path this entry is sourced from. */
#define AE_ENCRYPTION_NONE 0
#define AE_ENCRYPTION_DATA 1
#define AE_ENCRYPTION_METADATA 2
char encryption;
void *mac_metadata;
size_t mac_metadata_size;
/* ACL support. */
struct archive_acl acl;
/* extattr support. */
struct ae_xattr *xattr_head;
struct ae_xattr *xattr_p;
/* sparse support. */
struct ae_sparse *sparse_head;
struct ae_sparse *sparse_tail;
struct ae_sparse *sparse_p;
/* Miscellaneous. */
char strmode[12];
/* Symlink type support */
int ae_symlink_type;
};
#endif /* ARCHIVE_ENTRY_PRIVATE_H_INCLUDED */

View File

@ -1,156 +0,0 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* Copyright (c) 2010-2011 Michihiro NAKAJIMA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
__FBSDID("$FreeBSD$");
#include "archive.h"
#include "archive_entry.h"
#include "archive_private.h"
#include "archive_entry_private.h"
/*
* sparse handling
*/
void
archive_entry_sparse_clear(struct archive_entry *entry)
{
struct ae_sparse *sp;
while (entry->sparse_head != NULL) {
sp = entry->sparse_head->next;
free(entry->sparse_head);
entry->sparse_head = sp;
}
entry->sparse_tail = NULL;
}
void
archive_entry_sparse_add_entry(struct archive_entry *entry,
la_int64_t offset, la_int64_t length)
{
struct ae_sparse *sp;
if (offset < 0 || length < 0)
/* Invalid value */
return;
if (offset > INT64_MAX - length ||
offset + length > archive_entry_size(entry))
/* A value of "length" parameter is too large. */
return;
if ((sp = entry->sparse_tail) != NULL) {
if (sp->offset + sp->length > offset)
/* Invalid value. */
return;
if (sp->offset + sp->length == offset) {
if (sp->offset + sp->length + length < 0)
/* A value of "length" parameter is
* too large. */
return;
/* Expand existing sparse block size. */
sp->length += length;
return;
}
}
if ((sp = (struct ae_sparse *)malloc(sizeof(*sp))) == NULL)
/* XXX Error XXX */
return;
sp->offset = offset;
sp->length = length;
sp->next = NULL;
if (entry->sparse_head == NULL)
entry->sparse_head = entry->sparse_tail = sp;
else {
/* Add a new sparse block to the tail of list. */
if (entry->sparse_tail != NULL)
entry->sparse_tail->next = sp;
entry->sparse_tail = sp;
}
}
/*
* returns number of the sparse entries
*/
int
archive_entry_sparse_count(struct archive_entry *entry)
{
struct ae_sparse *sp;
int count = 0;
for (sp = entry->sparse_head; sp != NULL; sp = sp->next)
count++;
/*
* Sanity check if this entry is exactly sparse.
* If amount of sparse blocks is just one and it indicates the whole
* file data, we should remove it and return zero.
*/
if (count == 1) {
sp = entry->sparse_head;
if (sp->offset == 0 &&
sp->length >= archive_entry_size(entry)) {
count = 0;
archive_entry_sparse_clear(entry);
}
}
return (count);
}
int
archive_entry_sparse_reset(struct archive_entry * entry)
{
entry->sparse_p = entry->sparse_head;
return archive_entry_sparse_count(entry);
}
int
archive_entry_sparse_next(struct archive_entry * entry,
la_int64_t *offset, la_int64_t *length)
{
if (entry->sparse_p) {
*offset = entry->sparse_p->offset;
*length = entry->sparse_p->length;
entry->sparse_p = entry->sparse_p->next;
return (ARCHIVE_OK);
} else {
*offset = 0;
*length = 0;
return (ARCHIVE_WARN);
}
}
/*
* end of sparse handling
*/

View File

@ -1,118 +0,0 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_stat.c 201100 2009-12-28 03:05:31Z kientzle $");
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include "archive_entry.h"
#include "archive_entry_private.h"
const struct stat *
archive_entry_stat(struct archive_entry *entry)
{
struct stat *st;
if (entry->stat == NULL) {
entry->stat = calloc(1, sizeof(*st));
if (entry->stat == NULL)
return (NULL);
entry->stat_valid = 0;
}
/*
* If none of the underlying fields have been changed, we
* don't need to regenerate. In theory, we could use a bitmap
* here to flag only those items that have changed, but the
* extra complexity probably isn't worth it. It will be very
* rare for anyone to change just one field then request a new
* stat structure.
*/
if (entry->stat_valid)
return (entry->stat);
st = entry->stat;
/*
* Use the public interfaces to extract items, so that
* the appropriate conversions get invoked.
*/
st->st_atime = archive_entry_atime(entry);
#if HAVE_STRUCT_STAT_ST_BIRTHTIME
st->st_birthtime = archive_entry_birthtime(entry);
#endif
st->st_ctime = archive_entry_ctime(entry);
st->st_mtime = archive_entry_mtime(entry);
st->st_dev = archive_entry_dev(entry);
st->st_gid = (gid_t)archive_entry_gid(entry);
st->st_uid = (uid_t)archive_entry_uid(entry);
st->st_ino = (ino_t)archive_entry_ino64(entry);
st->st_nlink = archive_entry_nlink(entry);
st->st_rdev = archive_entry_rdev(entry);
st->st_size = (off_t)archive_entry_size(entry);
st->st_mode = archive_entry_mode(entry);
/*
* On systems that support high-res timestamps, copy that
* information into struct stat.
*/
#if HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
st->st_atimespec.tv_nsec = archive_entry_atime_nsec(entry);
st->st_ctimespec.tv_nsec = archive_entry_ctime_nsec(entry);
st->st_mtimespec.tv_nsec = archive_entry_mtime_nsec(entry);
#elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
st->st_atim.tv_nsec = archive_entry_atime_nsec(entry);
st->st_ctim.tv_nsec = archive_entry_ctime_nsec(entry);
st->st_mtim.tv_nsec = archive_entry_mtime_nsec(entry);
#elif HAVE_STRUCT_STAT_ST_MTIME_N
st->st_atime_n = archive_entry_atime_nsec(entry);
st->st_ctime_n = archive_entry_ctime_nsec(entry);
st->st_mtime_n = archive_entry_mtime_nsec(entry);
#elif HAVE_STRUCT_STAT_ST_UMTIME
st->st_uatime = archive_entry_atime_nsec(entry) / 1000;
st->st_uctime = archive_entry_ctime_nsec(entry) / 1000;
st->st_umtime = archive_entry_mtime_nsec(entry) / 1000;
#elif HAVE_STRUCT_STAT_ST_MTIME_USEC
st->st_atime_usec = archive_entry_atime_nsec(entry) / 1000;
st->st_ctime_usec = archive_entry_ctime_nsec(entry) / 1000;
st->st_mtime_usec = archive_entry_mtime_nsec(entry) / 1000;
#endif
#if HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
st->st_birthtimespec.tv_nsec = archive_entry_birthtime_nsec(entry);
#endif
/*
* TODO: On Linux, store 32 or 64 here depending on whether
* the cached stat structure is a stat32 or a stat64. This
* will allow us to support both variants interchangeably.
*/
entry->stat_valid = 1;
return (st);
}

View File

@ -1,87 +0,0 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_strmode.c,v 1.4 2008/06/15 05:14:01 kientzle Exp $");
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "archive_entry.h"
#include "archive_entry_private.h"
const char *
archive_entry_strmode(struct archive_entry *entry)
{
static const mode_t permbits[] =
{ 0400, 0200, 0100, 0040, 0020, 0010, 0004, 0002, 0001 };
char *bp = entry->strmode;
mode_t mode;
int i;
/* Fill in a default string, then selectively override. */
strcpy(bp, "?rwxrwxrwx ");
mode = archive_entry_mode(entry);
switch (archive_entry_filetype(entry)) {
case AE_IFREG: bp[0] = '-'; break;
case AE_IFBLK: bp[0] = 'b'; break;
case AE_IFCHR: bp[0] = 'c'; break;
case AE_IFDIR: bp[0] = 'd'; break;
case AE_IFLNK: bp[0] = 'l'; break;
case AE_IFSOCK: bp[0] = 's'; break;
case AE_IFIFO: bp[0] = 'p'; break;
default:
if (archive_entry_hardlink(entry) != NULL) {
bp[0] = 'h';
break;
}
}
for (i = 0; i < 9; i++)
if (!(mode & permbits[i]))
bp[i+1] = '-';
if (mode & S_ISUID) {
if (mode & 0100) bp[3] = 's';
else bp[3] = 'S';
}
if (mode & S_ISGID) {
if (mode & 0010) bp[6] = 's';
else bp[6] = 'S';
}
if (mode & S_ISVTX) {
if (mode & 0001) bp[9] = 't';
else bp[9] = 'T';
}
if (archive_entry_acl_types(entry) != 0)
bp[10] = '+';
return (bp);
}

View File

@ -1,156 +0,0 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_xattr.c 201096 2009-12-28 02:41:27Z kientzle $");
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#ifdef HAVE_LINUX_FS_H
#include <linux/fs.h> /* for Linux file flags */
#endif
/*
* Some Linux distributions have both linux/ext2_fs.h and ext2fs/ext2_fs.h.
* As the include guards don't agree, the order of include is important.
*/
#ifdef HAVE_LINUX_EXT2_FS_H
#include <linux/ext2_fs.h> /* for Linux file flags */
#endif
#if defined(HAVE_EXT2FS_EXT2_FS_H) && !defined(__CYGWIN__)
#include <ext2fs/ext2_fs.h> /* for Linux file flags */
#endif
#include <stddef.h>
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_WCHAR_H
#include <wchar.h>
#endif
#include "archive.h"
#include "archive_entry.h"
#include "archive_private.h"
#include "archive_entry_private.h"
/*
* extended attribute handling
*/
void
archive_entry_xattr_clear(struct archive_entry *entry)
{
struct ae_xattr *xp;
while (entry->xattr_head != NULL) {
xp = entry->xattr_head->next;
free(entry->xattr_head->name);
free(entry->xattr_head->value);
free(entry->xattr_head);
entry->xattr_head = xp;
}
entry->xattr_head = NULL;
}
void
archive_entry_xattr_add_entry(struct archive_entry *entry,
const char *name, const void *value, size_t size)
{
struct ae_xattr *xp;
if ((xp = (struct ae_xattr *)malloc(sizeof(struct ae_xattr))) == NULL)
__archive_errx(1, "Out of memory");
if ((xp->name = strdup(name)) == NULL)
__archive_errx(1, "Out of memory");
if ((xp->value = malloc(size)) != NULL) {
memcpy(xp->value, value, size);
xp->size = size;
} else
xp->size = 0;
xp->next = entry->xattr_head;
entry->xattr_head = xp;
}
/*
* returns number of the extended attribute entries
*/
int
archive_entry_xattr_count(struct archive_entry *entry)
{
struct ae_xattr *xp;
int count = 0;
for (xp = entry->xattr_head; xp != NULL; xp = xp->next)
count++;
return count;
}
int
archive_entry_xattr_reset(struct archive_entry * entry)
{
entry->xattr_p = entry->xattr_head;
return archive_entry_xattr_count(entry);
}
int
archive_entry_xattr_next(struct archive_entry * entry,
const char **name, const void **value, size_t *size)
{
if (entry->xattr_p) {
*name = entry->xattr_p->name;
*value = entry->xattr_p->value;
*size = entry->xattr_p->size;
entry->xattr_p = entry->xattr_p->next;
return (ARCHIVE_OK);
} else {
*name = NULL;
*value = NULL;
*size = (size_t)0;
return (ARCHIVE_WARN);
}
}
/*
* end of xattr handling
*/

File diff suppressed because it is too large Load Diff

View File

@ -1,39 +0,0 @@
/*-
* Copyright (c) 2003-2015 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef ARCHIVE_GETDATE_H_INCLUDED
#define ARCHIVE_GETDATE_H_INCLUDED
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
#include <time.h>
time_t __archive_get_date(time_t now, const char *);
#endif

View File

@ -1,305 +0,0 @@
/*-
* Copyright (c) 2014 Michihiro NAKAJIMA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "archive.h"
#include "archive_hmac_private.h"
/*
* On systems that do not support any recognized crypto libraries,
* the archive_hmac.c file is expected to define no usable symbols.
*
* But some compilers and linkers choke on empty object files, so
* define a public symbol that will always exist. This could
* be removed someday if this file gains another always-present
* symbol definition.
*/
int __libarchive_hmac_build_hack(void) {
return 0;
}
#ifdef ARCHIVE_HMAC_USE_Apple_CommonCrypto
static int
__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len)
{
CCHmacInit(ctx, kCCHmacAlgSHA1, key, key_len);
return 0;
}
static void
__hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data,
size_t data_len)
{
CCHmacUpdate(ctx, data, data_len);
}
static void
__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len)
{
CCHmacFinal(ctx, out);
*out_len = 20;
}
static void
__hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
{
memset(ctx, 0, sizeof(*ctx));
}
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
#ifndef BCRYPT_HASH_REUSABLE_FLAG
# define BCRYPT_HASH_REUSABLE_FLAG 0x00000020
#endif
static int
__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len)
{
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wcast-qual"
#endif
BCRYPT_ALG_HANDLE hAlg;
BCRYPT_HASH_HANDLE hHash;
DWORD hash_len;
PBYTE hash;
ULONG result;
NTSTATUS status;
ctx->hAlg = NULL;
status = BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_SHA1_ALGORITHM,
MS_PRIMITIVE_PROVIDER, BCRYPT_ALG_HANDLE_HMAC_FLAG);
if (!BCRYPT_SUCCESS(status))
return -1;
status = BCryptGetProperty(hAlg, BCRYPT_HASH_LENGTH, (PUCHAR)&hash_len,
sizeof(hash_len), &result, 0);
if (!BCRYPT_SUCCESS(status)) {
BCryptCloseAlgorithmProvider(hAlg, 0);
return -1;
}
hash = (PBYTE)HeapAlloc(GetProcessHeap(), 0, hash_len);
if (hash == NULL) {
BCryptCloseAlgorithmProvider(hAlg, 0);
return -1;
}
status = BCryptCreateHash(hAlg, &hHash, NULL, 0,
(PUCHAR)key, (ULONG)key_len, BCRYPT_HASH_REUSABLE_FLAG);
if (!BCRYPT_SUCCESS(status)) {
BCryptCloseAlgorithmProvider(hAlg, 0);
HeapFree(GetProcessHeap(), 0, hash);
return -1;
}
ctx->hAlg = hAlg;
ctx->hHash = hHash;
ctx->hash_len = hash_len;
ctx->hash = hash;
return 0;
}
static void
__hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data,
size_t data_len)
{
BCryptHashData(ctx->hHash, (PUCHAR)(uintptr_t)data, (ULONG)data_len, 0);
}
static void
__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len)
{
BCryptFinishHash(ctx->hHash, ctx->hash, ctx->hash_len, 0);
if (ctx->hash_len == *out_len)
memcpy(out, ctx->hash, *out_len);
}
static void
__hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
{
if (ctx->hAlg != NULL) {
BCryptCloseAlgorithmProvider(ctx->hAlg, 0);
HeapFree(GetProcessHeap(), 0, ctx->hash);
ctx->hAlg = NULL;
}
}
#elif defined(HAVE_LIBMBEDCRYPTO) && defined(HAVE_MBEDTLS_MD_H)
static int
__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len)
{
const mbedtls_md_info_t *info;
int ret;
mbedtls_md_init(ctx);
info = mbedtls_md_info_from_type(MBEDTLS_MD_SHA1);
if (info == NULL) {
mbedtls_md_free(ctx);
return (-1);
}
ret = mbedtls_md_setup(ctx, info, 1);
if (ret != 0) {
mbedtls_md_free(ctx);
return (-1);
}
ret = mbedtls_md_hmac_starts(ctx, key, key_len);
if (ret != 0) {
mbedtls_md_free(ctx);
return (-1);
}
return 0;
}
static void
__hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data,
size_t data_len)
{
mbedtls_md_hmac_update(ctx, data, data_len);
}
static void __hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len)
{
(void)out_len; /* UNUSED */
mbedtls_md_hmac_finish(ctx, out);
}
static void __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
{
mbedtls_md_free(ctx);
memset(ctx, 0, sizeof(*ctx));
}
#elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_HMAC_H)
static int
__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len)
{
hmac_sha1_set_key(ctx, key_len, key);
return 0;
}
static void
__hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data,
size_t data_len)
{
hmac_sha1_update(ctx, data_len, data);
}
static void
__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len)
{
hmac_sha1_digest(ctx, (unsigned)*out_len, out);
}
static void
__hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
{
memset(ctx, 0, sizeof(*ctx));
}
#elif defined(HAVE_LIBCRYPTO)
static int
__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len)
{
*ctx = HMAC_CTX_new();
if (*ctx == NULL)
return -1;
HMAC_Init_ex(*ctx, key, key_len, EVP_sha1(), NULL);
return 0;
}
static void
__hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data,
size_t data_len)
{
HMAC_Update(*ctx, data, data_len);
}
static void
__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len)
{
unsigned int len = (unsigned int)*out_len;
HMAC_Final(*ctx, out, &len);
*out_len = len;
}
static void
__hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
{
HMAC_CTX_free(*ctx);
*ctx = NULL;
}
#else
/* Stub */
static int
__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len)
{
(void)ctx;/* UNUSED */
(void)key;/* UNUSED */
(void)key_len;/* UNUSED */
return -1;
}
static void
__hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data,
size_t data_len)
{
(void)ctx;/* UNUSED */
(void)data;/* UNUSED */
(void)data_len;/* UNUSED */
}
static void
__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len)
{
(void)ctx;/* UNUSED */
(void)out;/* UNUSED */
(void)out_len;/* UNUSED */
}
static void
__hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
{
(void)ctx;/* UNUSED */
}
#endif
const struct archive_hmac __archive_hmac = {
&__hmac_sha1_init,
&__hmac_sha1_update,
&__hmac_sha1_final,
&__hmac_sha1_cleanup,
};

View File

@ -1,110 +0,0 @@
/*-
* Copyright (c) 2014 Michihiro NAKAJIMA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ARCHIVE_HMAC_PRIVATE_H_INCLUDED
#define ARCHIVE_HMAC_PRIVATE_H_INCLUDED
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
/*
* On systems that do not support any recognized crypto libraries,
* the archive_hmac.c file is expected to define no usable symbols.
*
* But some compilers and linkers choke on empty object files, so
* define a public symbol that will always exist. This could
* be removed someday if this file gains another always-present
* symbol definition.
*/
int __libarchive_hmac_build_hack(void);
#ifdef __APPLE__
# include <AvailabilityMacros.h>
# if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
# define ARCHIVE_HMAC_USE_Apple_CommonCrypto
# endif
#endif
#ifdef ARCHIVE_HMAC_USE_Apple_CommonCrypto
#include <CommonCrypto/CommonHMAC.h>
typedef CCHmacContext archive_hmac_sha1_ctx;
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
#include <bcrypt.h>
typedef struct {
BCRYPT_ALG_HANDLE hAlg;
BCRYPT_HASH_HANDLE hHash;
DWORD hash_len;
PBYTE hash;
} archive_hmac_sha1_ctx;
#elif defined(HAVE_LIBMBEDCRYPTO) && defined(HAVE_MBEDTLS_MD_H)
#include <mbedtls/md.h>
typedef mbedtls_md_context_t archive_hmac_sha1_ctx;
#elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_HMAC_H)
#include <nettle/hmac.h>
typedef struct hmac_sha1_ctx archive_hmac_sha1_ctx;
#elif defined(HAVE_LIBCRYPTO)
#include "archive_openssl_hmac_private.h"
typedef HMAC_CTX* archive_hmac_sha1_ctx;
#else
typedef int archive_hmac_sha1_ctx;
#endif
/* HMAC */
#define archive_hmac_sha1_init(ctx, key, key_len)\
__archive_hmac.__hmac_sha1_init(ctx, key, key_len)
#define archive_hmac_sha1_update(ctx, data, data_len)\
__archive_hmac.__hmac_sha1_update(ctx, data, data_len)
#define archive_hmac_sha1_final(ctx, out, out_len)\
__archive_hmac.__hmac_sha1_final(ctx, out, out_len)
#define archive_hmac_sha1_cleanup(ctx)\
__archive_hmac.__hmac_sha1_cleanup(ctx)
struct archive_hmac {
/* HMAC */
int (*__hmac_sha1_init)(archive_hmac_sha1_ctx *, const uint8_t *,
size_t);
void (*__hmac_sha1_update)(archive_hmac_sha1_ctx *, const uint8_t *,
size_t);
void (*__hmac_sha1_final)(archive_hmac_sha1_ctx *, uint8_t *, size_t *);
void (*__hmac_sha1_cleanup)(archive_hmac_sha1_ctx *);
};
extern const struct archive_hmac __archive_hmac;
#endif /* ARCHIVE_HMAC_PRIVATE_H_INCLUDED */

File diff suppressed because it is too large Load Diff

View File

@ -1,53 +0,0 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ARCHIVE_OPENSSL_EVP_PRIVATE_H_INCLUDED
#define ARCHIVE_OPENSSL_EVP_PRIVATE_H_INCLUDED
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
#include <openssl/evp.h>
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#include <stdlib.h> /* malloc, free */
#include <string.h> /* memset */
static inline EVP_MD_CTX *EVP_MD_CTX_new(void)
{
EVP_MD_CTX *ctx = (EVP_MD_CTX *)calloc(1, sizeof(EVP_MD_CTX));
return ctx;
}
static inline void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
{
EVP_MD_CTX_cleanup(ctx);
memset(ctx, 0, sizeof(*ctx));
free(ctx);
}
#endif
#endif

View File

@ -1,54 +0,0 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ARCHIVE_OPENSSL_HMAC_PRIVATE_H_INCLUDED
#define ARCHIVE_OPENSSL_HMAC_PRIVATE_H_INCLUDED
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
#include <openssl/hmac.h>
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
#include <stdlib.h> /* malloc, free */
#include <string.h> /* memset */
static inline HMAC_CTX *HMAC_CTX_new(void)
{
HMAC_CTX *ctx = (HMAC_CTX *)calloc(1, sizeof(HMAC_CTX));
return ctx;
}
static inline void HMAC_CTX_free(HMAC_CTX *ctx)
{
HMAC_CTX_cleanup(ctx);
memset(ctx, 0, sizeof(*ctx));
free(ctx);
}
#endif
#endif

View File

@ -1,218 +0,0 @@
/*-
* Copyright (c) 2011 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
__FBSDID("$FreeBSD$");
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#include "archive_options_private.h"
static const char *
parse_option(const char **str,
const char **mod, const char **opt, const char **val);
int
_archive_set_option(struct archive *a,
const char *m, const char *o, const char *v,
int magic, const char *fn, option_handler use_option)
{
const char *mp, *op, *vp;
int r;
archive_check_magic(a, magic, ARCHIVE_STATE_NEW, fn);
mp = (m != NULL && m[0] != '\0') ? m : NULL;
op = (o != NULL && o[0] != '\0') ? o : NULL;
vp = (v != NULL && v[0] != '\0') ? v : NULL;
if (op == NULL && vp == NULL)
return (ARCHIVE_OK);
if (op == NULL) {
archive_set_error(a, ARCHIVE_ERRNO_MISC, "Empty option");
return (ARCHIVE_FAILED);
}
r = use_option(a, mp, op, vp);
if (r == ARCHIVE_WARN - 1) {
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Unknown module name: `%s'", mp);
return (ARCHIVE_FAILED);
}
if (r == ARCHIVE_WARN) {
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Undefined option: `%s%s%s%s%s%s'",
vp?"":"!", mp?mp:"", mp?":":"", op, vp?"=":"", vp?vp:"");
return (ARCHIVE_FAILED);
}
return (r);
}
int
_archive_set_either_option(struct archive *a, const char *m, const char *o, const char *v,
option_handler use_format_option, option_handler use_filter_option)
{
int r1, r2;
if (o == NULL && v == NULL)
return (ARCHIVE_OK);
if (o == NULL)
return (ARCHIVE_FAILED);
r1 = use_format_option(a, m, o, v);
if (r1 == ARCHIVE_FATAL)
return (ARCHIVE_FATAL);
r2 = use_filter_option(a, m, o, v);
if (r2 == ARCHIVE_FATAL)
return (ARCHIVE_FATAL);
if (r2 == ARCHIVE_WARN - 1)
return r1;
return r1 > r2 ? r1 : r2;
}
int
_archive_set_options(struct archive *a, const char *options,
int magic, const char *fn, option_handler use_option)
{
int allok = 1, anyok = 0, ignore_mod_err = 0, r;
char *data;
const char *s, *mod, *opt, *val;
archive_check_magic(a, magic, ARCHIVE_STATE_NEW, fn);
if (options == NULL || options[0] == '\0')
return ARCHIVE_OK;
if ((data = strdup(options)) == NULL) {
archive_set_error(a,
ENOMEM, "Out of memory adding file to list");
return (ARCHIVE_FATAL);
}
s = (const char *)data;
do {
mod = opt = val = NULL;
parse_option(&s, &mod, &opt, &val);
if (mod == NULL && opt != NULL &&
strcmp("__ignore_wrong_module_name__", opt) == 0) {
/* Ignore module name error */
if (val != NULL) {
ignore_mod_err = 1;
anyok = 1;
}
continue;
}
r = use_option(a, mod, opt, val);
if (r == ARCHIVE_FATAL) {
free(data);
return (ARCHIVE_FATAL);
}
if (r == ARCHIVE_FAILED && mod != NULL) {
free(data);
return (ARCHIVE_FAILED);
}
if (r == ARCHIVE_WARN - 1) {
if (ignore_mod_err)
continue;
/* The module name is wrong. */
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Unknown module name: `%s'", mod);
free(data);
return (ARCHIVE_FAILED);
}
if (r == ARCHIVE_WARN) {
/* The option name is wrong. No-one used this. */
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Undefined option: `%s%s%s'",
mod?mod:"", mod?":":"", opt);
free(data);
return (ARCHIVE_FAILED);
}
if (r == ARCHIVE_OK)
anyok = 1;
else
allok = 0;
} while (s != NULL);
free(data);
return allok ? ARCHIVE_OK : anyok ? ARCHIVE_WARN : ARCHIVE_FAILED;
}
static const char *
parse_option(const char **s, const char **m, const char **o, const char **v)
{
const char *end, *mod, *opt, *val;
char *p;
end = NULL;
mod = NULL;
opt = *s;
val = "1";
p = strchr(opt, ',');
if (p != NULL) {
*p = '\0';
end = ((const char *)p) + 1;
}
if (0 == strlen(opt)) {
*s = end;
*m = NULL;
*o = NULL;
*v = NULL;
return end;
}
p = strchr(opt, ':');
if (p != NULL) {
*p = '\0';
mod = opt;
opt = ++p;
}
p = strchr(opt, '=');
if (p != NULL) {
*p = '\0';
val = ++p;
} else if (opt[0] == '!') {
++opt;
val = NULL;
}
*s = end;
*m = mod;
*o = opt;
*v = val;
return end;
}

View File

@ -1,51 +0,0 @@
/*-
* Copyright (c) 2011 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ARCHIVE_OPTIONS_PRIVATE_H_INCLUDED
#define ARCHIVE_OPTIONS_PRIVATE_H_INCLUDED
#include "archive_platform.h"
__FBSDID("$FreeBSD$");
#include "archive_private.h"
typedef int (*option_handler)(struct archive *a,
const char *mod, const char *opt, const char *val);
int
_archive_set_option(struct archive *a,
const char *mod, const char *opt, const char *val,
int magic, const char *fn, option_handler use_option);
int
_archive_set_options(struct archive *a, const char *options,
int magic, const char *fn, option_handler use_option);
int
_archive_set_either_option(struct archive *a,
const char *m, const char *o, const char *v,
option_handler use_format_option, option_handler use_filter_option);
#endif

View File

@ -1,336 +0,0 @@
/* $NetBSD: pack_dev.c,v 1.12 2013/06/14 16:28:20 tsutsui Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Charles M. Hannum.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Originally from NetBSD's mknod(8) source. */
#include "archive_platform.h"
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
#if !defined(lint)
__RCSID("$NetBSD$");
#endif /* not lint */
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#if MAJOR_IN_MKDEV
#include <sys/mkdev.h>
#define HAVE_MAJOR
#elif MAJOR_IN_SYSMACROS
#include <sys/sysmacros.h>
#define HAVE_MAJOR
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "archive_pack_dev.h"
static pack_t pack_netbsd;
static pack_t pack_freebsd;
static pack_t pack_8_8;
static pack_t pack_12_20;
static pack_t pack_14_18;
static pack_t pack_8_24;
static pack_t pack_bsdos;
static int compare_format(const void *, const void *);
static const char iMajorError[] = "invalid major number";
static const char iMinorError[] = "invalid minor number";
static const char tooManyFields[] = "too many fields for format";
/* This is blatantly stolen from libarchive/archive_entry.c,
* in an attempt to get this to play nice on MinGW... */
#if !defined(HAVE_MAJOR) && !defined(major)
/* Replacement for major/minor/makedev. */
#define major(x) ((int)(0x00ff & ((x) >> 8)))
#define minor(x) ((int)(0xffff00ff & (x)))
#define makedev(maj,min) ((0xff00 & ((maj)<<8)) | (0xffff00ff & (min)))
#endif
/* Play games to come up with a suitable makedev() definition. */
#ifdef __QNXNTO__
/* QNX. <sigh> */
#include <sys/netmgr.h>
#define apd_makedev(maj, min) makedev(ND_LOCAL_NODE, (maj), (min))
#elif defined makedev
/* There's a "makedev" macro. */
#define apd_makedev(maj, min) makedev((maj), (min))
#elif defined mkdev || ((defined _WIN32 || defined __WIN32__) && !defined(__CYGWIN__))
/* Windows. <sigh> */
#define apd_makedev(maj, min) mkdev((maj), (min))
#else
/* There's a "makedev" function. */
#define apd_makedev(maj, min) makedev((maj), (min))
#endif
/* exported */
dev_t
pack_native(int n, unsigned long numbers[], const char **error)
{
dev_t dev = 0;
if (n == 2) {
dev = apd_makedev(numbers[0], numbers[1]);
if ((unsigned long)major(dev) != numbers[0])
*error = iMajorError;
else if ((unsigned long)minor(dev) != numbers[1])
*error = iMinorError;
} else
*error = tooManyFields;
return (dev);
}
static dev_t
pack_netbsd(int n, unsigned long numbers[], const char **error)
{
dev_t dev = 0;
if (n == 2) {
dev = makedev_netbsd(numbers[0], numbers[1]);
if ((unsigned long)major_netbsd(dev) != numbers[0])
*error = iMajorError;
else if ((unsigned long)minor_netbsd(dev) != numbers[1])
*error = iMinorError;
} else
*error = tooManyFields;
return (dev);
}
#define major_freebsd(x) ((int32_t)(((x) & 0x0000ff00) >> 8))
#define minor_freebsd(x) ((int32_t)(((x) & 0xffff00ff) >> 0))
#define makedev_freebsd(x,y) ((dev_t)((((x) << 8) & 0x0000ff00) | \
(((y) << 0) & 0xffff00ff)))
static dev_t
pack_freebsd(int n, unsigned long numbers[], const char **error)
{
dev_t dev = 0;
if (n == 2) {
dev = makedev_freebsd(numbers[0], numbers[1]);
if ((unsigned long)major_freebsd(dev) != numbers[0])
*error = iMajorError;
if ((unsigned long)minor_freebsd(dev) != numbers[1])
*error = iMinorError;
} else
*error = tooManyFields;
return (dev);
}
#define major_8_8(x) ((int32_t)(((x) & 0x0000ff00) >> 8))
#define minor_8_8(x) ((int32_t)(((x) & 0x000000ff) >> 0))
#define makedev_8_8(x,y) ((dev_t)((((x) << 8) & 0x0000ff00) | \
(((y) << 0) & 0x000000ff)))
static dev_t
pack_8_8(int n, unsigned long numbers[], const char **error)
{
dev_t dev = 0;
if (n == 2) {
dev = makedev_8_8(numbers[0], numbers[1]);
if ((unsigned long)major_8_8(dev) != numbers[0])
*error = iMajorError;
if ((unsigned long)minor_8_8(dev) != numbers[1])
*error = iMinorError;
} else
*error = tooManyFields;
return (dev);
}
#define major_12_20(x) ((int32_t)(((x) & 0xfff00000) >> 20))
#define minor_12_20(x) ((int32_t)(((x) & 0x000fffff) >> 0))
#define makedev_12_20(x,y) ((dev_t)((((x) << 20) & 0xfff00000) | \
(((y) << 0) & 0x000fffff)))
static dev_t
pack_12_20(int n, unsigned long numbers[], const char **error)
{
dev_t dev = 0;
if (n == 2) {
dev = makedev_12_20(numbers[0], numbers[1]);
if ((unsigned long)major_12_20(dev) != numbers[0])
*error = iMajorError;
if ((unsigned long)minor_12_20(dev) != numbers[1])
*error = iMinorError;
} else
*error = tooManyFields;
return (dev);
}
#define major_14_18(x) ((int32_t)(((x) & 0xfffc0000) >> 18))
#define minor_14_18(x) ((int32_t)(((x) & 0x0003ffff) >> 0))
#define makedev_14_18(x,y) ((dev_t)((((x) << 18) & 0xfffc0000) | \
(((y) << 0) & 0x0003ffff)))
static dev_t
pack_14_18(int n, unsigned long numbers[], const char **error)
{
dev_t dev = 0;
if (n == 2) {
dev = makedev_14_18(numbers[0], numbers[1]);
if ((unsigned long)major_14_18(dev) != numbers[0])
*error = iMajorError;
if ((unsigned long)minor_14_18(dev) != numbers[1])
*error = iMinorError;
} else
*error = tooManyFields;
return (dev);
}
#define major_8_24(x) ((int32_t)(((x) & 0xff000000) >> 24))
#define minor_8_24(x) ((int32_t)(((x) & 0x00ffffff) >> 0))
#define makedev_8_24(x,y) ((dev_t)((((x) << 24) & 0xff000000) | \
(((y) << 0) & 0x00ffffff)))
static dev_t
pack_8_24(int n, unsigned long numbers[], const char **error)
{
dev_t dev = 0;
if (n == 2) {
dev = makedev_8_24(numbers[0], numbers[1]);
if ((unsigned long)major_8_24(dev) != numbers[0])
*error = iMajorError;
if ((unsigned long)minor_8_24(dev) != numbers[1])
*error = iMinorError;
} else
*error = tooManyFields;
return (dev);
}
#define major_12_12_8(x) ((int32_t)(((x) & 0xfff00000) >> 20))
#define unit_12_12_8(x) ((int32_t)(((x) & 0x000fff00) >> 8))
#define subunit_12_12_8(x) ((int32_t)(((x) & 0x000000ff) >> 0))
#define makedev_12_12_8(x,y,z) ((dev_t)((((x) << 20) & 0xfff00000) | \
(((y) << 8) & 0x000fff00) | \
(((z) << 0) & 0x000000ff)))
static dev_t
pack_bsdos(int n, unsigned long numbers[], const char **error)
{
dev_t dev = 0;
if (n == 2) {
dev = makedev_12_20(numbers[0], numbers[1]);
if ((unsigned long)major_12_20(dev) != numbers[0])
*error = iMajorError;
if ((unsigned long)minor_12_20(dev) != numbers[1])
*error = iMinorError;
} else if (n == 3) {
dev = makedev_12_12_8(numbers[0], numbers[1], numbers[2]);
if ((unsigned long)major_12_12_8(dev) != numbers[0])
*error = iMajorError;
if ((unsigned long)unit_12_12_8(dev) != numbers[1])
*error = "invalid unit number";
if ((unsigned long)subunit_12_12_8(dev) != numbers[2])
*error = "invalid subunit number";
} else
*error = tooManyFields;
return (dev);
}
/* list of formats and pack functions */
/* this list must be sorted lexically */
static const struct format {
const char *name;
pack_t *pack;
} formats[] = {
{"386bsd", pack_8_8},
{"4bsd", pack_8_8},
{"bsdos", pack_bsdos},
{"freebsd", pack_freebsd},
{"hpux", pack_8_24},
{"isc", pack_8_8},
{"linux", pack_8_8},
{"native", pack_native},
{"netbsd", pack_netbsd},
{"osf1", pack_12_20},
{"sco", pack_8_8},
{"solaris", pack_14_18},
{"sunos", pack_8_8},
{"svr3", pack_8_8},
{"svr4", pack_14_18},
{"ultrix", pack_8_8},
};
static int
compare_format(const void *key, const void *element)
{
const char *name;
const struct format *format;
name = key;
format = element;
return (strcmp(name, format->name));
}
pack_t *
pack_find(const char *name)
{
struct format *format;
format = bsearch(name, formats,
sizeof(formats)/sizeof(formats[0]),
sizeof(formats[0]), compare_format);
if (format == 0)
return (NULL);
return (format->pack);
}

View File

@ -1,49 +0,0 @@
/* $NetBSD: pack_dev.h,v 1.8 2013/06/14 16:28:20 tsutsui Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Charles M. Hannum.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Originally from NetBSD's mknod(8) source. */
#ifndef ARCHIVE_PACK_DEV_H
#define ARCHIVE_PACK_DEV_H
typedef dev_t pack_t(int, unsigned long [], const char **);
pack_t *pack_find(const char *);
pack_t pack_native;
#define major_netbsd(x) ((int32_t)((((x) & 0x000fff00) >> 8)))
#define minor_netbsd(x) ((int32_t)((((x) & 0xfff00000) >> 12) | \
(((x) & 0x000000ff) >> 0)))
#define makedev_netbsd(x,y) ((dev_t)((((x) << 8) & 0x000fff00) | \
(((y) << 12) & 0xfff00000) | \
(((y) << 0) & 0x000000ff)))
#endif /* ARCHIVE_PACK_DEV_H */

View File

@ -1,459 +0,0 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "archive_platform.h"
__FBSDID("$FreeBSD$");
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_WCHAR_H
#include <wchar.h>
#endif
#include "archive_pathmatch.h"
/*
* Check whether a character 'c' is matched by a list specification [...]:
* * Leading '!' or '^' negates the class.
* * <char>-<char> is a range of characters
* * \<char> removes any special meaning for <char>
*
* Some interesting boundary cases:
* a-d-e is one range (a-d) followed by two single characters - and e.
* \a-\d is same as a-d
* a\-d is three single characters: a, d, -
* Trailing - is not special (so [a-] is two characters a and -).
* Initial - is not special ([a-] is same as [-a] is same as [\\-a])
* This function never sees a trailing \.
* [] always fails
* [!] always succeeds
*/
static int
pm_list(const char *start, const char *end, const char c, int flags)
{
const char *p = start;
char rangeStart = '\0', nextRangeStart;
int match = 1, nomatch = 0;
/* This will be used soon... */
(void)flags; /* UNUSED */
/* If this is a negated class, return success for nomatch. */
if ((*p == '!' || *p == '^') && p < end) {
match = 0;
nomatch = 1;
++p;
}
while (p < end) {
nextRangeStart = '\0';
switch (*p) {
case '-':
/* Trailing or initial '-' is not special. */
if ((rangeStart == '\0') || (p == end - 1)) {
if (*p == c)
return (match);
} else {
char rangeEnd = *++p;
if (rangeEnd == '\\')
rangeEnd = *++p;
if ((rangeStart <= c) && (c <= rangeEnd))
return (match);
}
break;
case '\\':
++p;
/* Fall through */
default:
if (*p == c)
return (match);
nextRangeStart = *p; /* Possible start of range. */
}
rangeStart = nextRangeStart;
++p;
}
return (nomatch);
}
static int
pm_list_w(const wchar_t *start, const wchar_t *end, const wchar_t c, int flags)
{
const wchar_t *p = start;
wchar_t rangeStart = L'\0', nextRangeStart;
int match = 1, nomatch = 0;
/* This will be used soon... */
(void)flags; /* UNUSED */
/* If this is a negated class, return success for nomatch. */
if ((*p == L'!' || *p == L'^') && p < end) {
match = 0;
nomatch = 1;
++p;
}
while (p < end) {
nextRangeStart = L'\0';
switch (*p) {
case L'-':
/* Trailing or initial '-' is not special. */
if ((rangeStart == L'\0') || (p == end - 1)) {
if (*p == c)
return (match);
} else {
wchar_t rangeEnd = *++p;
if (rangeEnd == L'\\')
rangeEnd = *++p;
if ((rangeStart <= c) && (c <= rangeEnd))
return (match);
}
break;
case L'\\':
++p;
/* Fall through */
default:
if (*p == c)
return (match);
nextRangeStart = *p; /* Possible start of range. */
}
rangeStart = nextRangeStart;
++p;
}
return (nomatch);
}
/*
* If s is pointing to "./", ".//", "./././" or the like, skip it.
*/
static const char *
pm_slashskip(const char *s) {
while ((*s == '/')
|| (s[0] == '.' && s[1] == '/')
|| (s[0] == '.' && s[1] == '\0'))
++s;
return (s);
}
static const wchar_t *
pm_slashskip_w(const wchar_t *s) {
while ((*s == L'/')
|| (s[0] == L'.' && s[1] == L'/')
|| (s[0] == L'.' && s[1] == L'\0'))
++s;
return (s);
}
static int
pm(const char *p, const char *s, int flags)
{
const char *end;
/*
* Ignore leading './', './/', '././', etc.
*/
if (s[0] == '.' && s[1] == '/')
s = pm_slashskip(s + 1);
if (p[0] == '.' && p[1] == '/')
p = pm_slashskip(p + 1);
for (;;) {
switch (*p) {
case '\0':
if (s[0] == '/') {
if (flags & PATHMATCH_NO_ANCHOR_END)
return (1);
/* "dir" == "dir/" == "dir/." */
s = pm_slashskip(s);
}
return (*s == '\0');
case '?':
/* ? always succeeds, unless we hit end of 's' */
if (*s == '\0')
return (0);
break;
case '*':
/* "*" == "**" == "***" ... */
while (*p == '*')
++p;
/* Trailing '*' always succeeds. */
if (*p == '\0')
return (1);
while (*s) {
if (archive_pathmatch(p, s, flags))
return (1);
++s;
}
return (0);
case '[':
/*
* Find the end of the [...] character class,
* ignoring \] that might occur within the class.
*/
end = p + 1;
while (*end != '\0' && *end != ']') {
if (*end == '\\' && end[1] != '\0')
++end;
++end;
}
if (*end == ']') {
/* We found [...], try to match it. */
if (!pm_list(p + 1, end, *s, flags))
return (0);
p = end; /* Jump to trailing ']' char. */
break;
} else
/* No final ']', so just match '['. */
if (*p != *s)
return (0);
break;
case '\\':
/* Trailing '\\' matches itself. */
if (p[1] == '\0') {
if (*s != '\\')
return (0);
} else {
++p;
if (*p != *s)
return (0);
}
break;
case '/':
if (*s != '/' && *s != '\0')
return (0);
/* Note: pattern "/\./" won't match "/";
* pm_slashskip() correctly stops at backslash. */
p = pm_slashskip(p);
s = pm_slashskip(s);
if (*p == '\0' && (flags & PATHMATCH_NO_ANCHOR_END))
return (1);
--p; /* Counteract the increment below. */
--s;
break;
case '$':
/* '$' is special only at end of pattern and only
* if PATHMATCH_NO_ANCHOR_END is specified. */
if (p[1] == '\0' && (flags & PATHMATCH_NO_ANCHOR_END)){
/* "dir" == "dir/" == "dir/." */
return (*pm_slashskip(s) == '\0');
}
/* Otherwise, '$' is not special. */
/* FALL THROUGH */
default:
if (*p != *s)
return (0);
break;
}
++p;
++s;
}
}
static int
pm_w(const wchar_t *p, const wchar_t *s, int flags)
{
const wchar_t *end;
/*
* Ignore leading './', './/', '././', etc.
*/
if (s[0] == L'.' && s[1] == L'/')
s = pm_slashskip_w(s + 1);
if (p[0] == L'.' && p[1] == L'/')
p = pm_slashskip_w(p + 1);
for (;;) {
switch (*p) {
case L'\0':
if (s[0] == L'/') {
if (flags & PATHMATCH_NO_ANCHOR_END)
return (1);
/* "dir" == "dir/" == "dir/." */
s = pm_slashskip_w(s);
}
return (*s == L'\0');
case L'?':
/* ? always succeeds, unless we hit end of 's' */
if (*s == L'\0')
return (0);
break;
case L'*':
/* "*" == "**" == "***" ... */
while (*p == L'*')
++p;
/* Trailing '*' always succeeds. */
if (*p == L'\0')
return (1);
while (*s) {
if (archive_pathmatch_w(p, s, flags))
return (1);
++s;
}
return (0);
case L'[':
/*
* Find the end of the [...] character class,
* ignoring \] that might occur within the class.
*/
end = p + 1;
while (*end != L'\0' && *end != L']') {
if (*end == L'\\' && end[1] != L'\0')
++end;
++end;
}
if (*end == L']') {
/* We found [...], try to match it. */
if (!pm_list_w(p + 1, end, *s, flags))
return (0);
p = end; /* Jump to trailing ']' char. */
break;
} else
/* No final ']', so just match '['. */
if (*p != *s)
return (0);
break;
case L'\\':
/* Trailing '\\' matches itself. */
if (p[1] == L'\0') {
if (*s != L'\\')
return (0);
} else {
++p;
if (*p != *s)
return (0);
}
break;
case L'/':
if (*s != L'/' && *s != L'\0')
return (0);
/* Note: pattern "/\./" won't match "/";
* pm_slashskip() correctly stops at backslash. */
p = pm_slashskip_w(p);
s = pm_slashskip_w(s);
if (*p == L'\0' && (flags & PATHMATCH_NO_ANCHOR_END))
return (1);
--p; /* Counteract the increment below. */
--s;
break;
case L'$':
/* '$' is special only at end of pattern and only
* if PATHMATCH_NO_ANCHOR_END is specified. */
if (p[1] == L'\0' && (flags & PATHMATCH_NO_ANCHOR_END)){
/* "dir" == "dir/" == "dir/." */
return (*pm_slashskip_w(s) == L'\0');
}
/* Otherwise, '$' is not special. */
/* FALL THROUGH */
default:
if (*p != *s)
return (0);
break;
}
++p;
++s;
}
}
/* Main entry point. */
int
__archive_pathmatch(const char *p, const char *s, int flags)
{
/* Empty pattern only matches the empty string. */
if (p == NULL || *p == '\0')
return (s == NULL || *s == '\0');
/* Leading '^' anchors the start of the pattern. */
if (*p == '^') {
++p;
flags &= ~PATHMATCH_NO_ANCHOR_START;
}
if (*p == '/' && *s != '/')
return (0);
/* Certain patterns anchor implicitly. */
if (*p == '*' || *p == '/') {
while (*p == '/')
++p;
while (*s == '/')
++s;
return (pm(p, s, flags));
}
/* If start is unanchored, try to match start of each path element. */
if (flags & PATHMATCH_NO_ANCHOR_START) {
for ( ; s != NULL; s = strchr(s, '/')) {
if (*s == '/')
s++;
if (pm(p, s, flags))
return (1);
}
return (0);
}
/* Default: Match from beginning. */
return (pm(p, s, flags));
}
int
__archive_pathmatch_w(const wchar_t *p, const wchar_t *s, int flags)
{
/* Empty pattern only matches the empty string. */
if (p == NULL || *p == L'\0')
return (s == NULL || *s == L'\0');
/* Leading '^' anchors the start of the pattern. */
if (*p == L'^') {
++p;
flags &= ~PATHMATCH_NO_ANCHOR_START;
}
if (*p == L'/' && *s != L'/')
return (0);
/* Certain patterns anchor implicitly. */
if (*p == L'*' || *p == L'/') {
while (*p == L'/')
++p;
while (*s == L'/')
++s;
return (pm_w(p, s, flags));
}
/* If start is unanchored, try to match start of each path element. */
if (flags & PATHMATCH_NO_ANCHOR_START) {
for ( ; s != NULL; s = wcschr(s, L'/')) {
if (*s == L'/')
s++;
if (pm_w(p, s, flags))
return (1);
}
return (0);
}
/* Default: Match from beginning. */
return (pm_w(p, s, flags));
}

View File

@ -1,52 +0,0 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef ARCHIVE_PATHMATCH_H
#define ARCHIVE_PATHMATCH_H
#ifndef __LIBARCHIVE_BUILD
#ifndef __LIBARCHIVE_TEST
#error This header is only to be used internally to libarchive.
#endif
#endif
/* Don't anchor at beginning unless the pattern starts with "^" */
#define PATHMATCH_NO_ANCHOR_START 1
/* Don't anchor at end unless the pattern ends with "$" */
#define PATHMATCH_NO_ANCHOR_END 2
/* Note that "^" and "$" are not special unless you set the corresponding
* flag above. */
int __archive_pathmatch(const char *p, const char *s, int flags);
int __archive_pathmatch_w(const wchar_t *p, const wchar_t *s, int flags);
#define archive_pathmatch(p, s, f) __archive_pathmatch(p, s, f)
#define archive_pathmatch_w(p, s, f) __archive_pathmatch_w(p, s, f)
#endif

View File

@ -1,202 +0,0 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: head/lib/libarchive/archive_platform.h 201090 2009-12-28 02:22:04Z kientzle $
*/
/* !!ONLY FOR USE INTERNALLY TO LIBARCHIVE!! */
/*
* This header is the first thing included in any of the libarchive
* source files. As far as possible, platform-specific issues should
* be dealt with here and not within individual source files. I'm
* actively trying to minimize #if blocks within the main source,
* since they obfuscate the code.
*/
#ifndef ARCHIVE_PLATFORM_H_INCLUDED
#define ARCHIVE_PLATFORM_H_INCLUDED
/* archive.h and archive_entry.h require this. */
#define __LIBARCHIVE_BUILD 1
#if defined(PLATFORM_CONFIG_H)
/* Use hand-built config.h in environments that need it. */
#include PLATFORM_CONFIG_H
#elif defined(HAVE_CONFIG_H)
/* Most POSIX platforms use the 'configure' script to build config.h */
#include "config.h"
#else
/* Warn if the library hasn't been (automatically or manually) configured. */
#error Oops: No config.h and no pre-built configuration in archive_platform.h.
#endif
/* On macOS check for some symbols based on the deployment target version. */
#if defined(__APPLE__)
# undef HAVE_FUTIMENS
# undef HAVE_UTIMENSAT
# include <AvailabilityMacros.h>
# if MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
# define HAVE_FUTIMENS 1
# define HAVE_UTIMENSAT 1
# endif
#endif
/* It should be possible to get rid of this by extending the feature-test
* macros to cover Windows API functions, probably along with non-trivial
* refactoring of code to find structures that sit more cleanly on top of
* either Windows or Posix APIs. */
#if (defined(__WIN32__) || defined(_WIN32) || defined(__WIN32)) && !defined(__CYGWIN__)
#include "archive_windows.h"
#else
#define la_stat(path,stref) stat(path,stref)
#endif
/*
* The config files define a lot of feature macros. The following
* uses those macros to select/define replacements and include key
* headers as required.
*/
/* Get a real definition for __FBSDID or __RCSID if we can */
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
/* If not, define them so as to avoid dangling semicolons. */
#ifndef __FBSDID
#define __FBSDID(a) struct _undefined_hack
#endif
#ifndef __RCSID
#define __RCSID(a) struct _undefined_hack
#endif
/* Try to get standard C99-style integer type definitions. */
#if HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#if HAVE_STDINT_H
#include <stdint.h>
#endif
/* Borland warns about its own constants! */
#if defined(__BORLANDC__)
# if HAVE_DECL_UINT64_MAX
# undef UINT64_MAX
# undef HAVE_DECL_UINT64_MAX
# endif
# if HAVE_DECL_UINT64_MIN
# undef UINT64_MIN
# undef HAVE_DECL_UINT64_MIN
# endif
# if HAVE_DECL_INT64_MAX
# undef INT64_MAX
# undef HAVE_DECL_INT64_MAX
# endif
# if HAVE_DECL_INT64_MIN
# undef INT64_MIN
# undef HAVE_DECL_INT64_MIN
# endif
#endif
/* Some platforms lack the standard *_MAX definitions. */
#if !HAVE_DECL_SIZE_MAX
#define SIZE_MAX (~(size_t)0)
#endif
#if !HAVE_DECL_SSIZE_MAX
#define SSIZE_MAX ((ssize_t)(SIZE_MAX >> 1))
#endif
#if !HAVE_DECL_UINT32_MAX
#define UINT32_MAX (~(uint32_t)0)
#endif
#if !HAVE_DECL_INT32_MAX
#define INT32_MAX ((int32_t)(UINT32_MAX >> 1))
#endif
#if !HAVE_DECL_INT32_MIN
#define INT32_MIN ((int32_t)(~INT32_MAX))
#endif
#if !HAVE_DECL_UINT64_MAX
#define UINT64_MAX (~(uint64_t)0)
#endif
#if !HAVE_DECL_INT64_MAX
#define INT64_MAX ((int64_t)(UINT64_MAX >> 1))
#endif
#if !HAVE_DECL_INT64_MIN
#define INT64_MIN ((int64_t)(~INT64_MAX))
#endif
#if !HAVE_DECL_UINTMAX_MAX
#define UINTMAX_MAX (~(uintmax_t)0)
#endif
#if !HAVE_DECL_INTMAX_MAX
#define INTMAX_MAX ((intmax_t)(UINTMAX_MAX >> 1))
#endif
#if !HAVE_DECL_INTMAX_MIN
#define INTMAX_MIN ((intmax_t)(~INTMAX_MAX))
#endif
/*
* If we can't restore metadata using a file descriptor, then
* for compatibility's sake, close files before trying to restore metadata.
*/
#if defined(HAVE_FCHMOD) || defined(HAVE_FUTIMES) || defined(HAVE_ACL_SET_FD) || defined(HAVE_ACL_SET_FD_NP) || defined(HAVE_FCHOWN)
#define CAN_RESTORE_METADATA_FD
#endif
/*
* glibc 2.24 deprecates readdir_r
*/
#if defined(HAVE_READDIR_R) && (!defined(__GLIBC__) || !defined(__GLIBC_MINOR__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 24))
#define USE_READDIR_R 1
#else
#undef USE_READDIR_R
#endif
/* Set up defaults for internal error codes. */
#ifndef ARCHIVE_ERRNO_FILE_FORMAT
#if HAVE_EFTYPE
#define ARCHIVE_ERRNO_FILE_FORMAT EFTYPE
#else
#if HAVE_EILSEQ
#define ARCHIVE_ERRNO_FILE_FORMAT EILSEQ
#else
#define ARCHIVE_ERRNO_FILE_FORMAT EINVAL
#endif
#endif
#endif
#ifndef ARCHIVE_ERRNO_PROGRAMMER
#define ARCHIVE_ERRNO_PROGRAMMER EINVAL
#endif
#ifndef ARCHIVE_ERRNO_MISC
#define ARCHIVE_ERRNO_MISC (-1)
#endif
#if defined(__GNUC__) && (__GNUC__ >= 7)
#define __LA_FALLTHROUGH __attribute__((fallthrough))
#else
#define __LA_FALLTHROUGH
#endif
#endif /* !ARCHIVE_PLATFORM_H_INCLUDED */

View File

@ -1,55 +0,0 @@
/*-
* Copyright (c) 2017 Martin Matuska
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD$
*/
/* !!ONLY FOR USE INTERNALLY TO LIBARCHIVE!! */
#ifndef ARCHIVE_PLATFORM_ACL_H_INCLUDED
#define ARCHIVE_PLATFORM_ACL_H_INCLUDED
#ifndef __LIBARCHIVE_BUILD
#ifndef __LIBARCHIVE_TEST_COMMON
#error This header is only to be used internally to libarchive.
#endif
#endif
/*
* Determine what ACL types are supported
*/
#if ARCHIVE_ACL_FREEBSD || ARCHIVE_ACL_SUNOS || ARCHIVE_ACL_LIBACL
#define ARCHIVE_ACL_POSIX1E 1
#endif
#if ARCHIVE_ACL_FREEBSD_NFS4 || ARCHIVE_ACL_SUNOS_NFS4 || \
ARCHIVE_ACL_DARWIN || ARCHIVE_ACL_LIBRICHACL
#define ARCHIVE_ACL_NFS4 1
#endif
#if ARCHIVE_ACL_POSIX1E || ARCHIVE_ACL_NFS4
#define ARCHIVE_ACL_SUPPORT 1
#endif
#endif /* ARCHIVE_PLATFORM_ACL_H_INCLUDED */

Some files were not shown because too many files have changed in this diff Show More