facebook / buck

A fast build system that encourages the creation of small, reusable modules over a variety of platforms and languages.
https://buck.build
Apache License 2.0
8.56k stars 1.16k forks source link

buck fetch fails with symbolic links in an archive #2731

Open yasinhin opened 1 year ago

yasinhin commented 1 year ago

I am trying to add ldap as a dependency using http_archive but buck fails to fetch the library. There is a "broken link" symbolic link in the tests folder which causes buck to fail on sha verification. Is there a way to skip that verification for that specific folder? I am okay to delete that specific folder before verification as well but not sure how.

http_archive(
  name = 'libopenldap-src',
  urls = ['https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-2.5.13.tgz'],
  sha256 = 'ee3c430c4ef7b87c57b622108c7339376d6c27fbbf2767770be3de1df63d008c',
  strip_prefix = 'openldap-2.5.13',
  type = 'tar.gz'
)

buck fetch //...:libopenldap-src

Buck encountered an internal error
com.facebook.buck.command.Build$BuildExecutionException: com.facebook.buck.core.exceptions.BuckUncheckedExecutionException: When finalizing rule.: java.lang.RuntimeException: java.io.IOException: Error computing Sha1 for /Users/yasinh/Desktop/DDDCore/buck-out/gen/libraries/3rdparty/libopenldap/libopenldap-src/libopenldap-src/tests/data/homedir/skel/directory/broken link: /Users/yasinh/Desktop/DDDCore/buck-out/gen/libraries/3rdparty/libopenldap/libopenldap-src/libopenldap-src/tests/data/homedir/skel/directory/broken link
    at com.facebook.buck.command.Build.waitForBuildToFinish(Build.java:297)
    at com.facebook.buck.command.Build.waitForBuildToFinishAndPrintFailuresToEventBus(Build.java:394)
    at com.facebook.buck.command.Build.executeAndPrintFailuresToEventBus(Build.java:136)
    at com.facebook.buck.cli.FetchCommand.runWithoutHelp(FetchCommand.java:174)
    at com.facebook.buck.cli.AbstractCommand.run(AbstractCommand.java:281)
    at com.facebook.buck.cli.AbstractContainerCommand.run(AbstractContainerCommand.java:90)
    at com.facebook.buck.cli.MainRunner.runMainWithExitCode(MainRunner.java:1448)
    at com.facebook.buck.cli.MainRunner.runMainThenExit(MainRunner.java:476)
    at com.facebook.buck.cli.MainWithNailgun.nailMain(MainWithNailgun.java:77)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.facebook.nailgun.NGSession.runImpl(NGSession.java:313)
    at com.facebook.nailgun.NGSession.run(NGSession.java:199)
yasinhin commented 1 year ago

I mitigated issue by adding some custom rules around it like below. Still I believe this seems to be a bug anyways.

remote_file(
  name = 'libopenldap-src',
  url = 'https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-2.5.13.tgz',
  sha1 = '134993a045d69a95a62867fae390e8ae38230c7d',
)

genrule(
  name = 'libopenldap-unzip',
  cmd = 'tar -xf $(location :libopenldap-src) -C $OUT --exclude tests/data',
  out = '.',
)