thw
(Thorbjørn Weidemann)
September 12, 2024, 9:02am
1
Even with a simple new project created with
swiftpm init --name app --type executable
and adding
dependencies: [
.package(url: "GitHub - swiftlang/swift-docc-plugin: Swift Package Manager command plugin for Swift-DocC ", from: "1.0.0"),
],
to Package swift, I get the following error when running
swift package plugin generate-documentation
...
Building documentation for 'app'...
Error: Error Domain=NSCocoaErrorDomain Code=513 "You don't have permission."
error: 'docc convert' invocation failed with a nonzero exit code: '1'
error: Error Domain=NSCocoaErrorDomain Code=4 "The file doesn't exist."
The error does not occur using swift 5.10.1.
But using
swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a-ubi9 on AlmaLinux 9
swift-6.0-DEVELOPMENT-SNAPSHOT-2024-07-19-a-centos7.tar.gz on Almalinux 8
swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a-ubuntu20.04 on Ubuntu 20.04 (tried 2 different installations)
I get this error.
Would be grateful if anyone could offer a workaround. Unfortunately the error message does not say which permission or which file is missing.
1 Like
I'm still seeing this with Swift 6.0.2. Running with swift package plugin generate-documentation --verbose
shows that the command that actually fails looks like this /opt/usr/lib/bin/docc convert --emit-lmdb-index --fallback-display-name [lib name] --fallback-bundle-identifier [lib name] --additional-symbol-graph-dir [cwd]/.build/x86_64-unknown-linux-gnu/extracted-symbols/swift/[lib name] --output-path [cwd]/.build/plugins/Swift-DocC/outputs/intermediates/[lib name].doccarchive
Running the same command with strace
shows the stack trace for the failing syscall and the one before it:
chmod("/tmp/55E11227-4BE3-4BB4-931A-E746CD588B3F-2248221-0000D204964632AD/css", 0755) = 0
> /usr/lib/x86_64-linux-gnu/libc.so.6(chmod+0x7) [0xfeb27]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials16_FileManagerImplV13setAttributes_12ofItemAtPathySDyAA0C12AttributeKeyVypG_SStKFySPys4Int8VGSgKXEfU_TA+0x163) [0x2d3b43]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($sSS20FoundationEssentialsE28withFileSystemRepresentationyxxSPys4Int8VGSgKXEKlFxAEKXEfU_TA+0xc) [0x29534c]
> /opt/usr/lib/swift/linux/libswiftCore.so($ss11_StringGutsV11withCStringyxxSPys4Int8VGKXEKlFxSRyAEGKXEfU_TA+0x11) [0x299f31]
> /opt/usr/lib/swift/linux/libswiftCore.so($sSS11withCStringyxxSPys4Int8VGKXEKlF+0x82) [0x317182]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials11FileManagerC04withC20SystemRepresentation3for_xSS_xSPys4Int8VGSgKXEtKlF+0x2e) [0x32044e]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials16_FileManagerImplV13setAttributes_12ofItemAtPathySDyAA0C12AttributeKeyVypG_SStKF+0x1dc) [0x19c7fc]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials11FileManagerC13setAttributes_12ofItemAtPathySDyAA0C12AttributeKeyVypG_SStKF+0x41) [0x31f3b1]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials15_FileOperationsO011_linkOrCopyC033_54538455693C81BE2FDBED43BE08DD07LL__4with8delegateySPys4Int8VG_AjA0C7ManagerCxtKAA04LinkfG8DelegateAELLRzlFZySryAIGKXEfU_AC04copyC0_2toAF7optionsySS_SSAlA06NSFilepG7OptionsVtKFZ0gcR0L_V_Tg5+0x576) [0x1a0f56]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials15_FileOperationsO011_linkOrCopyC033_54538455693C81BE2FDBED43BE08DD07LL__4with8delegateySPys4Int8VG_AjA0C7ManagerCxtKAA04LinkfG8DelegateAELLRzlFZAC04copyC0_2toAF7optionsySS_SSAlA06NSFilepG7OptionsVtKFZ0gcR0L_V_Tgm5+0xcc) [0x1a089c]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials15_FileOperationsO010linkOrCopyC033_54538455693C81BE2FDBED43BE08DD07LL_3dst4with8delegateySS_SSAA0C7ManagerCxtKAA04LinkfG8DelegateAELLRzlFZySPys4Int8VGSgKXEfU_yAOKXEfU_AC04copyC0_2toAG7optionsySS_SSAjA06NSFilepG7OptionsVtKFZ0gcR0L_V_TG5+0x33) [0x25d663]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials15_FileOperationsO010linkOrCopyC033_54538455693C81BE2FDBED43BE08DD07LL_3dst4with8delegateySS_SSAA0C7ManagerCxtKAA04LinkfG8DelegateAELLRzlFZySPys4Int8VGSgKXEfU_yAOKXEfU_AC0eC0_2toAGySS_SSAJtKFZ0qcR0L_V_TG5TATm+0x1b) [0x2d355b]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials15_FileOperationsO010linkOrCopyC033_54538455693C81BE2FDBED43BE08DD07LL_3dst4with8delegateySS_SSAA0C7ManagerCxtKAA04LinkfG8DelegateAELLRzlFZySPys4Int8VGSgKXEfU_yAOKXEfU_AC04copyC0_2toAG7optionsySS_SSAjA06NSFilepG7OptionsVtKFZ0gcR0L_V_TG5TA+0xd) [0x2d353d]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($sSS11withCStringyxxSPys4Int8VGKXEKlFyt_Tg5065$sSS20FoundationEssentialsE28withFileSystemRepresentationyxxSPys4C25VGSgKXEKlFxAEKXEfU_yt_Tg5ADSgxs5Error_pRi_zRi0_zlyytIsgyrzo_Tf1ncn_n+0x7a) [0x1866fa]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials15_FileOperationsO010linkOrCopyC033_54538455693C81BE2FDBED43BE08DD07LL_3dst4with8delegateySS_SSAA0C7ManagerCxtKAA04LinkfG8DelegateAELLRzlFZySPys4Int8VGSgKXEfU_AC04copyC0_2toAG7optionsySS_SSAjA06NSFilepG7OptionsVtKFZ0gcR0L_V_Tg5+0x69) [0x1a47a9]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials15_FileOperationsO010linkOrCopyC033_54538455693C81BE2FDBED43BE08DD07LL_3dst4with8delegateySS_SSAA0C7ManagerCxtKAA04LinkfG8DelegateAELLRzlFZySPys4Int8VGSgKXEfU_AC04copyC0_2toAG7optionsySS_SSAjA06NSFilepG7OptionsVtKFZ0gcR0L_V_TG5TATm+0x32) [0x2d35a2]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials15_FileOperationsO010linkOrCopyC033_54538455693C81BE2FDBED43BE08DD07LL_3dst4with8delegateySS_SSAA0C7ManagerCxtKAA04LinkfG8DelegateAELLRzlFZySPys4Int8VGSgKXEfU_AC04copyC0_2toAG7optionsySS_SSAjA06NSFilepG7OptionsVtKFZ0gcR0L_V_TG5TA.300+0x6) [0x2d3566]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($sSS11withCStringyxxSPys4Int8VGKXEKlFyt_Tg5065$sSS20FoundationEssentialsE28withFileSystemRepresentationyxxSPys4C25VGSgKXEKlFxAEKXEfU_yt_Tg5ADSgxs5Error_pRi_zRi0_zlyytIsgyrzo_Tf1ncn_n+0x7a) [0x1866fa]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials16_FileManagerImplV8copyItem6atPath02toI07optionsySS_SSAA06NSFileD11CopyOptionsVtKFTf4nndn_n+0x9a) [0x29e0da]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials16_FileManagerImplV8copyItem2at2to7optionsyAA3URLV_AiA06NSFileD11CopyOptionsVtKFTf4nndn_nTm+0x13b) [0x29e51b]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials11FileManagerC8moveItem2at2toyAA3URLV_AHtKFTm+0x55) [0x1a50b5]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials11FileManagerC8copyItem2at2toyAA3URLV_AHtKF+0xd) [0x31fcbd]
> /opt/usr/bin/docc($s20FoundationEssentials11FileManagerC9SwiftDocC0cD8ProtocolA2dEP8copyItem2at2toyAA3URLV_AKtKFTW+0x15) [0x5e7d35]
> /opt/usr/bin/docc($s18SwiftDocCUtilities13ConvertActionV7perform9logHandleAA0E6ResultV0aB1C03LogH0O_tKF+0x4cb) [0x9c7b1b]
> /opt/usr/bin/docc($s18SwiftDocCUtilities4DoccV7ConvertV3runyyKF+0x6e) [0x9bb05e]
> /opt/usr/bin/docc($s18SwiftDocCUtilities4DoccV7ConvertV14ArgumentParser15ParsableCommandAafGP3runyyKFTW+0x9) [0x99d209]
> /opt/usr/bin/docc(docc_main+0x5a) [0xadf12a]
> /usr/lib/x86_64-linux-gnu/libc.so.6(__libc_init_first+0x88) [0x29d68]
> /usr/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85) [0x29e25]
> /opt/usr/bin/docc(_start+0x21) [0x11b191]
chown("/tmp/55E11227-4BE3-4BB4-931A-E746CD588B3F-2248221-0000D204964632AD/css", 0, 0) = -1 EPERM (Operation not permitted)
> /usr/lib/x86_64-linux-gnu/libc.so.6(chown+0x7) [0xfeb57]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials16_FileManagerImplV13setAttributes_12ofItemAtPathySDyAA0C12AttributeKeyVypG_SStKFySPys4Int8VGSgKXEfU_TA+0x74b) [0x2d412b]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($sSS20FoundationEssentialsE28withFileSystemRepresentationyxxSPys4Int8VGSgKXEKlFxAEKXEfU_TA+0xc) [0x29534c]
> /opt/usr/lib/swift/linux/libswiftCore.so($ss11_StringGutsV11withCStringyxxSPys4Int8VGKXEKlFxSRyAEGKXEfU_TA+0x11) [0x299f31]
> /opt/usr/lib/swift/linux/libswiftCore.so($sSS11withCStringyxxSPys4Int8VGKXEKlF+0x82) [0x317182]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials11FileManagerC04withC20SystemRepresentation3for_xSS_xSPys4Int8VGSgKXEtKlF+0x2e) [0x32044e]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials16_FileManagerImplV13setAttributes_12ofItemAtPathySDyAA0C12AttributeKeyVypG_SStKF+0x1dc) [0x19c7fc]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials11FileManagerC13setAttributes_12ofItemAtPathySDyAA0C12AttributeKeyVypG_SStKF+0x41) [0x31f3b1]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials15_FileOperationsO011_linkOrCopyC033_54538455693C81BE2FDBED43BE08DD07LL__4with8delegateySPys4Int8VG_AjA0C7ManagerCxtKAA04LinkfG8DelegateAELLRzlFZySryAIGKXEfU_AC04copyC0_2toAF7optionsySS_SSAlA06NSFilepG7OptionsVtKFZ0gcR0L_V_Tg5+0x576) [0x1a0f56]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials15_FileOperationsO011_linkOrCopyC033_54538455693C81BE2FDBED43BE08DD07LL__4with8delegateySPys4Int8VG_AjA0C7ManagerCxtKAA04LinkfG8DelegateAELLRzlFZAC04copyC0_2toAF7optionsySS_SSAlA06NSFilepG7OptionsVtKFZ0gcR0L_V_Tgm5+0xcc) [0x1a089c]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials15_FileOperationsO010linkOrCopyC033_54538455693C81BE2FDBED43BE08DD07LL_3dst4with8delegateySS_SSAA0C7ManagerCxtKAA04LinkfG8DelegateAELLRzlFZySPys4Int8VGSgKXEfU_yAOKXEfU_AC04copyC0_2toAG7optionsySS_SSAjA06NSFilepG7OptionsVtKFZ0gcR0L_V_TG5+0x33) [0x25d663]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials15_FileOperationsO010linkOrCopyC033_54538455693C81BE2FDBED43BE08DD07LL_3dst4with8delegateySS_SSAA0C7ManagerCxtKAA04LinkfG8DelegateAELLRzlFZySPys4Int8VGSgKXEfU_yAOKXEfU_AC0eC0_2toAGySS_SSAJtKFZ0qcR0L_V_TG5TATm+0x1b) [0x2d355b]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials15_FileOperationsO010linkOrCopyC033_54538455693C81BE2FDBED43BE08DD07LL_3dst4with8delegateySS_SSAA0C7ManagerCxtKAA04LinkfG8DelegateAELLRzlFZySPys4Int8VGSgKXEfU_yAOKXEfU_AC04copyC0_2toAG7optionsySS_SSAjA06NSFilepG7OptionsVtKFZ0gcR0L_V_TG5TA+0xd) [0x2d353d]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($sSS11withCStringyxxSPys4Int8VGKXEKlFyt_Tg5065$sSS20FoundationEssentialsE28withFileSystemRepresentationyxxSPys4C25VGSgKXEKlFxAEKXEfU_yt_Tg5ADSgxs5Error_pRi_zRi0_zlyytIsgyrzo_Tf1ncn_n+0x7a) [0x1866fa]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials15_FileOperationsO010linkOrCopyC033_54538455693C81BE2FDBED43BE08DD07LL_3dst4with8delegateySS_SSAA0C7ManagerCxtKAA04LinkfG8DelegateAELLRzlFZySPys4Int8VGSgKXEfU_AC04copyC0_2toAG7optionsySS_SSAjA06NSFilepG7OptionsVtKFZ0gcR0L_V_Tg5+0x69) [0x1a47a9]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials15_FileOperationsO010linkOrCopyC033_54538455693C81BE2FDBED43BE08DD07LL_3dst4with8delegateySS_SSAA0C7ManagerCxtKAA04LinkfG8DelegateAELLRzlFZySPys4Int8VGSgKXEfU_AC04copyC0_2toAG7optionsySS_SSAjA06NSFilepG7OptionsVtKFZ0gcR0L_V_TG5TATm+0x32) [0x2d35a2]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials15_FileOperationsO010linkOrCopyC033_54538455693C81BE2FDBED43BE08DD07LL_3dst4with8delegateySS_SSAA0C7ManagerCxtKAA04LinkfG8DelegateAELLRzlFZySPys4Int8VGSgKXEfU_AC04copyC0_2toAG7optionsySS_SSAjA06NSFilepG7OptionsVtKFZ0gcR0L_V_TG5TA.300+0x6) [0x2d3566]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($sSS11withCStringyxxSPys4Int8VGKXEKlFyt_Tg5065$sSS20FoundationEssentialsE28withFileSystemRepresentationyxxSPys4C25VGSgKXEKlFxAEKXEfU_yt_Tg5ADSgxs5Error_pRi_zRi0_zlyytIsgyrzo_Tf1ncn_n+0x7a) [0x1866fa]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials16_FileManagerImplV8copyItem6atPath02toI07optionsySS_SSAA06NSFileD11CopyOptionsVtKFTf4nndn_n+0x9a) [0x29e0da]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials16_FileManagerImplV8copyItem2at2to7optionsyAA3URLV_AiA06NSFileD11CopyOptionsVtKFTf4nndn_nTm+0x13b) [0x29e51b]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials11FileManagerC8moveItem2at2toyAA3URLV_AHtKFTm+0x55) [0x1a50b5]
> /opt/usr/lib/swift/linux/libFoundationEssentials.so($s20FoundationEssentials11FileManagerC8copyItem2at2toyAA3URLV_AHtKF+0xd) [0x31fcbd]
> /opt/usr/bin/docc($s20FoundationEssentials11FileManagerC9SwiftDocC0cD8ProtocolA2dEP8copyItem2at2toyAA3URLV_AKtKFTW+0x15) [0x5e7d35]
> /opt/usr/bin/docc($s18SwiftDocCUtilities13ConvertActionV7perform9logHandleAA0E6ResultV0aB1C03LogH0O_tKF+0x4cb) [0x9c7b1b]
> /opt/usr/bin/docc($s18SwiftDocCUtilities4DoccV7ConvertV3runyyKF+0x6e) [0x9bb05e]
> /opt/usr/bin/docc($s18SwiftDocCUtilities4DoccV7ConvertV14ArgumentParser15ParsableCommandAafGP3runyyKFTW+0x9) [0x99d209]
> /opt/usr/bin/docc(docc_main+0x5a) [0xadf12a]
> /usr/lib/x86_64-linux-gnu/libc.so.6(__libc_init_first+0x88) [0x29d68]
> /usr/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85) [0x29e25]
> /opt/usr/bin/docc(_start+0x21) [0x11b191]
AFAICT it looks like there was an attempt to chown
a temporary directory to be owned by the root user, which the OS rejected.
powwow
January 10, 2025, 1:43pm
4
Does anyone know the latest status of this issue.
I have recently fallen over the same problem on Ubuntu 24.04 using Swift --version 6.0.3.
The concern for me is that if you already have documentation from a previous version of Swift and your using the "swift package --allow-writing-to-directory ./docs generate-documentation --target --output-path ./docs" command it deletes your ./docs directory completely and anything in it is lost.
powwow
January 24, 2025, 12:16pm
5
Please see the below bug in SwiftLang/swift-docc
https://github.com/swiftlang/swift-docc/issues/1136
I think this is the same issue that we have observed here, the only difference I can see is the platform, as I'm on Ubuntu where the toolchain installation location is "/opt/swift"
anyone have any thoughts ??
1 Like