Bug 210251 - GH_TUPLE generates wrong download url when group name includes a dash
Summary: GH_TUPLE generates wrong download url when group name includes a dash
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Port Management Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-13 10:29 UTC by Alexander Holte-Davidsen
Modified: 2016-06-19 11:26 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Holte-Davidsen 2016-06-13 10:29:47 UTC
When including a dash in the group name of a GH_TUPLE a wrong download link is generated.

Using:
GH_TUPLE=   dgrijalva:jwt-go:61124b62ad244d655f87d944aefaa2ae5a0d2f16:jwt-go

Running "make fetch" fails with the following message:
=> dgrijalva-jwt-go-61124b62ad244d655f87d944aefaa2ae5a0d2f16_GH0.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch godgrijalva-jwt-go-61124b62ad244d655f87d944aefaa2ae5a0d2f16_GH0.tar.gz
fetch: godgrijalva-jwt-go-61124b62ad244d655f87d944aefaa2ae5a0d2f16_GH0.tar.gz: No such file or directory
=> Attempting to fetch http://distcache.FreeBSD.org/ports-distfiles/dgrijalva-jwt-go-61124b62ad244d655f87d944aefaa2ae5a0d2f16_GH0.tar.gz
fetch: http://distcache.FreeBSD.org/ports-distfiles/dgrijalva-jwt-go-61124b62ad244d655f87d944aefaa2ae5a0d2f16_GH0.tar.gz: Not Found
=> Couldn't fetch it - please try to retrieve this
=> port manually into /usr/ports/distfiles/ and try again.

It seems to be adding everything specified after the dash to the url used by fetch.

When changing the group name to jwtgo, the download succeeds:
GH_TUPLE=   dgrijalva:jwt-go:61124b62ad244d655f87d944aefaa2ae5a0d2f16:jwtgo

=> dgrijalva-jwt-go-61124b62ad244d655f87d944aefaa2ae5a0d2f16_GH0.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch https://codeload.github.com/dgrijalva/jwt-go/tar.gz/61124b62ad244d655f87d944aefaa2ae5a0d2f16?dummy=/dgrijalva-jwt-go-61124b62ad244d655f87d944aefaa2ae5a0d2f16_GH0.tar.gz
fetch: https://codeload.github.com/dgrijalva/jwt-go/tar.gz/61124b62ad244d655f87d944aefaa2ae5a0d2f16?dummy=/dgrijalva-jwt-go-61124b62ad244d655f87d944aefaa2ae5a0d2f16_GH0.tar.gz: size unknown
fetch: https://codeload.github.com/dgrijalva/jwt-go/tar.gz/61124b62ad244d655f87d944aefaa2ae5a0d2f16?dummy=/dgrijalva-jwt-go-61124b62ad244d655f87d944aefaa2ae5a0d2f16_GH0.tar.gz: size of remote file is not known
dgrijalva-jwt-go-61124b62ad244d655f87d944aefaa          13 kB   65 MBps 00m00s
Comment 1 Mathieu Arnold freebsd_committer freebsd_triage 2016-06-14 10:16:10 UTC
Group names can't include dashes.
Comment 2 Alexander Holte-Davidsen 2016-06-14 12:22:04 UTC
(In reply to Mathieu Arnold from comment #1)
Is there a reason they can't include dashes?
Comment 3 Mathieu Arnold freebsd_committer freebsd_triage 2016-06-14 12:41:51 UTC
Yes, while make(1) is ok with variable names having quite a lot of strange characters, this is a limitation of sh, where a variable name can't include a dash.
It would be possible to fix this with silently replacing dashes with, say, underscores, but it would complicate the code a bit, and have the level of WTF while debugging go quite higher.
I'll try to see if I can error out when *_SITES groups contains characters other than [a-zA-Z0-9_]
Comment 4 Alexander Holte-Davidsen 2016-06-14 12:47:10 UTC
(In reply to Mathieu Arnold from comment #3)
I see! An error message would be really helpful! Also, the documentation should maybe mention this? I can't any documentation on this in the Porter's Handbook?
Comment 5 Mathieu Arnold freebsd_committer freebsd_triage 2016-06-14 13:07:49 UTC
Mmm, I thought the porter's handbook had a note about what was allowed, it currently says [0-9] which is wrong anyway. I'll fix it too.
Comment 6 commit-hook freebsd_committer freebsd_triage 2016-06-14 14:18:32 UTC
A commit references this bug:

Author: mat
Date: Tue Jun 14 14:17:44 UTC 2016
New revision: 48925
URL: https://svnweb.freebsd.org/changeset/doc/48925

Log:
  Document the fact that group names should be restricted to a certain
  character class.

  PR:		210251
  Sponsored by:	Absolight

Changes:
  head/en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml
Comment 7 Mathieu Arnold freebsd_committer freebsd_triage 2016-06-16 11:54:35 UTC
Part of #210198 that will fix this problem (well, it'll error out if the group contains an invalid character), so closing this here.
Comment 8 commit-hook freebsd_committer freebsd_triage 2016-06-19 11:26:49 UTC
A commit references this bug:

Author: mat
Date: Sun Jun 19 11:25:44 UTC 2016
New revision: 417113
URL: https://svnweb.freebsd.org/changeset/ports/417113

Log:
  Add a few checks for (MASTER|PATCH)_SITES groups.

  While make(1) is ok with variable names having quite a lot of strange
  characters in them, the fetch code mostly uses sh(1), where variable
  names can't include a dash (or pluses, or many other things).

  PR:		210251 210198
  Submitted by:	mat
  Exp-run by:	antoine
  Sponsored by:	The FreeBSD Foundation, Absolight
  Differential Revision:	https://reviews.freebsd.org/D6779

Changes:
  head/Mk/bsd.port.mk
  head/Mk/bsd.sites.mk