Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The second call to date in build.bash fails on Mac OS #570

Closed
GaelC92 opened this issue Jun 3, 2021 · 12 comments
Closed

The second call to date in build.bash fails on Mac OS #570

GaelC92 opened this issue Jun 3, 2021 · 12 comments
Labels
macOS Apple macOS ("darwin") specific issue needs more info

Comments

@GaelC92
Copy link

GaelC92 commented Jun 3, 2021

the date binary of Os X is not fully compliant with gnu date, and build fails.
as quick fix, one can install gdate with brew install coreutils, and patch the build.bash formula with brew edit.

here is my full formula for those willing to try the 2.0b4

class Gocryptfs < Formula
desc "Encrypted overlay filesystem written in Go"
homepage "https://nuetzlich.net/gocryptfs/"
url "https://github.com/rfjakob/gocryptfs/releases/download/v2.0-beta4/gocryptfs_v2.0-beta4_src-deps.tar.gz"
sha256 "d28c6b6a749e9f66745bd9a595b853b1ffde7ca3b2e82e0a41e9b3c40e7ebddd"
license "MIT"

depends_on "go" => :build
depends_on "pkg-config" => :build
depends_on "openssl@1.1"

on_macos do
end

on_linux do
depends_on "libfuse"
end

def install
inreplace "./build.bash",
"date ",
"/usr/local/bin/gdate "

ENV["GOPATH"] = buildpath
(buildpath/"src/github.com/rfjakob/gocryptfs").install buildpath.children
cd "src/github.com/rfjakob/gocryptfs" do
  system "./build.bash"
  bin.install "gocryptfs"
  prefix.install_metafiles
end

end

test do
(testpath/"encdir").mkpath
pipe_output("#{bin}/gocryptfs -init #{testpath}/encdir", "password", 0)
assert_predicate testpath/"encdir/gocryptfs.conf", :exist?
end
end

@GaelC92 GaelC92 changed the title The second call to date in build.bash fails on Mac Os. The second call to date in build.bash fails on Mac OS Jun 3, 2021
@rfjakob
Copy link
Owner

rfjakob commented Jun 3, 2021

I see two date calls in build.bash:

1:

date +%Y-%m-%d

2:

date --utc --date="@${SOURCE_DATE_EPOCH}" +%Y-%m-%d

Number (2) fails? Could you show the error? Also, (2) should only be called if SOURCE_DATE_EPOCH is set.

@charles-dyfis-net
Copy link
Contributor

charles-dyfis-net commented Jun 3, 2021

(2) is definitely GNU-only -- Apple's BSD date doesn't have a --date= at all. BTW, you could replace those with bash builtins if you have a guarantee of bash 4.3 or later (but that won't be available out-of-the-box on MacOS, where the default is 3.2; OTOH, if we're being built by MacPorts, it can certainly provide a newer one).

Aforementioned builtins:

printf '%(%Y-%m-%d)T' -1

TZ=UTC printf '%(%Y-%m-%d)T' "$SOURCE_DATE_EPOCH"

@GaelC92
Copy link
Author

GaelC92 commented Jun 5, 2021

I confirm that the second line is the culprit. The first is ok.

date --utc --date="@${SOURCE_DATE_EPOCH}" +%Y-%m-%d
date: illegal option -- -
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]

@rfjakob
Copy link
Owner

rfjakob commented Jun 5, 2021

Ok, but, who sets $SOURCE_DATE_EPOCH ?

@GaelC92
Copy link
Author

GaelC92 commented Jun 5, 2021

I have no clue :) – it is definitely not me, so probably somewhere in the build process.

@rfjakob
Copy link
Owner

rfjakob commented Jun 5, 2021

Probably this: Homebrew/brew#11141

That's also why the older formula worked ( https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/gocryptfs.rb )

@rfjakob rfjakob added the macOS Apple macOS ("darwin") specific issue label Jun 5, 2021
@GaelC92
Copy link
Author

GaelC92 commented Jun 5, 2021

yes. it might be set by cmake.

rfjakob added a commit that referenced this issue Jul 29, 2021
@rfjakob
Copy link
Owner

rfjakob commented Jul 29, 2021

@rfjakob
Copy link
Owner

rfjakob commented Sep 25, 2021

ping @GaelC92

@GaelC92
Copy link
Author

GaelC92 commented Sep 25, 2021 via email

@GaelC92
Copy link
Author

GaelC92 commented Sep 26, 2021

Hello @rfjakob ,

I was able to build it successfully from the source :

./gocryptfs -version
gocryptfs [unknown]; go-fuse v2.1.1-0.20210825171523-3ab5d95a30ae; 2021-09-26 go1.17.1 darwin/amd64

@rfjakob
Copy link
Owner

rfjakob commented Sep 28, 2021

Thanks for testing! Merged to master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
macOS Apple macOS ("darwin") specific issue needs more info
Projects
None yet
Development

No branches or pull requests

3 participants