Pull request diff cannot be displayed due to "fatal: cannot exec './transcode.pl': Permission denied" error

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問


プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

    

要約

The pull request diff cannot be displayed for a repository where the Transcode diffs option has been enabled.

The following error is shown when attempting to display the diff:

診断

The atlassian-bitbucket.log  file will show the following message when debug logging is enabled:

com.atlassian.bitbucket.scm.CommandFailedException: '/usr/local/bin/git diff -C --color=never -U10000 --dst-prefix=dst:// --src-prefix=src:// bf08ddcfd49beac2a149b099a3a78b13786f6948 17dac01b63ca4cc1771bc0e9a76ab1133c3ee57e -- b.txt' exited with code 128 saying: fatal: cannot exec './transcode.pl': Permission denied
fatal: unable to read files to diff
	at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onError(DefaultCommandExitHandler.java:47)
	at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:111)
	at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.onError(GitCommandExitHandler.java:208)
	at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onExit(DefaultCommandExitHandler.java:32)
	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.callExitHandler(NioNuProcessHandler.java:340)
	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.finish(NioNuProcessHandler.java:381)
	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.onExit(NioNuProcessHandler.java:136)
	at com.zaxxer.nuprocess.internal.BasePosixProcess.onExit(BasePosixProcess.java:315)
	at com.zaxxer.nuprocess.osx.ProcessKqueue.processEvent(ProcessKqueue.java:339)
	at com.zaxxer.nuprocess.osx.ProcessKqueue.process(ProcessKqueue.java:238)
	at com.zaxxer.nuprocess.internal.BaseEventProcessor.run(BaseEventProcessor.java:82)
	at com.zaxxer.nuprocess.osx.OsxProcess.run(OsxProcess.java:112)
	at com.zaxxer.nuprocess.osx.OsxProcessFactory.runProcess(OsxProcessFactory.java:43)
	at com.zaxxer.nuprocess.NuProcessBuilder.run(NuProcessBuilder.java:273)
	at com.atlassian.bitbucket.internal.process.nu.NuNioProcessHelper.run(NuNioProcessHelper.java:75)
	at com.atlassian.bitbucket.internal.process.NioCommand.call(NioCommand.java:46)
	at com.atlassian.stash.internal.commit.DefaultCommitService.streamDiff(DefaultCommitService.java:320)
...
Caused by: com.atlassian.utils.process.ProcessException: Non-zero exit code: 128
	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.callExitHandler(NioNuProcessHandler.java:332)
	... 57 common frames omitted


原因

When Transcode diffs feature has been enabled on a repository, a Perl script, transcode.pl is created in the repository's location on disk path (<BITBUCKET_HOME>/shared/data/repositories/<REPO_ID>/).

The OS user for starting Bitbucket should be the owner of this script and should have read, write and execute permissions on the script.

If the Bitbucket OS user is unable to access and execute the transcode.pl script for any reason, the fatal: cannot exec './transcode.pl': Permission denied error will be encountered and the pull request diff cannot be displayed in the UI.

ソリューション

To resolve the issue:

  1. Find the repo's location on disk: In the Bitbucket UI, go to: Repository settings > Repository details and take note of the Location on disk path
  2. On the filesystem, go to the Location on disk path
  3. Check the file permissions on the transcode.pl script and ensure the Bitbucket OS user is able to read, write and execute it.

    1. Below is a sample of the expected permission settings. In this sample, the Bitbucket OS user is atlbitbucket 

      -rwxr--r--  1 atlbitbucket atlbitbucket 1593 Jan  4 05:14 transcode.pl
  4. Set the correct file permissions, as needed.

注意

  1. If you would like to check if there is any other repositories are affected, you can run the following command: 

    cd <Bitbucket shared home>/data/repositories
    find . -maxdepth 2 -name "transcode.pl" -printf "sym perm="%M/"perm="%m/"size="%s/"user="%u/"group="%g/"name="%p/"type="%Y\\n
  2. 結果 

    sym perm=-rwxr--r--/perm=744/size=1593/user=atlbitbucket/group=atlbitbucket/name=./1/transcode.pl/type=f
    sym perm=-rwxr--r--/perm=744/size=1593/user=atlbitbucket/group=atlbitbucket/name=./2/transcode.pl/type=f
  3. If you would like to know the affected repositories from the UI, you will need to query the repositories' details from the database using this SQL: 
    select p.project_key, r.slug from repository r join project p on r.project_id = p.id where r.id in (1, 2);

    (info) Replace the IDs with the affected repositories ID from the find command's result.


最終更新日: 2024 年 2 月 19 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.