Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(452)

Issue 6734046: charm: disallow juju-* hooks on read

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 6 months ago by fwereade
Modified:
11 years, 6 months ago
Reviewers:
mp+130310
Visibility:
Public.

Description

charm: disallow juju-* hooks on read https://code.launchpad.net/~fwereade/juju-core/charm-disallow-juju-hooks/+merge/130310 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 5

Patch Set 2 : charm: disallow juju-* hooks on read #

Total comments: 5

Patch Set 3 : charm: disallow juju-* hooks on read #

Unified diffs Side-by-side diffs Delta from patch set Stats (+47 lines, -1 line) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M charm/bundle.go View 2 chunks +7 lines, -1 line 0 comments Download
M charm/bundle_test.go View 1 2 1 chunk +9 lines, -0 lines 0 comments Download
M charm/charm.go View 1 2 2 chunks +11 lines, -0 lines 0 comments Download
M charm/dir.go View 1 2 1 chunk +10 lines, -0 lines 0 comments Download
M charm/dir_test.go View 1 2 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 6
fwereade
Please take a look.
11 years, 6 months ago (2012-10-18 09:44:28 UTC) #1
rog
LGTM modulo the below consideration. https://codereview.appspot.com/6734046/diff/1/charm/dir.go File charm/dir.go (right): https://codereview.appspot.com/6734046/diff/1/charm/dir.go#newcode61 charm/dir.go:61: fis, err := ioutil.ReadDir(dir.join("hooks")) ...
11 years, 6 months ago (2012-10-18 09:51:52 UTC) #2
fwereade
Please take a look. https://codereview.appspot.com/6734046/diff/1/charm/dir.go File charm/dir.go (right): https://codereview.appspot.com/6734046/diff/1/charm/dir.go#newcode61 charm/dir.go:61: fis, err := ioutil.ReadDir(dir.join("hooks")) On ...
11 years, 6 months ago (2012-10-18 12:42:36 UTC) #3
rog
https://codereview.appspot.com/6734046/diff/1/charm/dir.go File charm/dir.go (right): https://codereview.appspot.com/6734046/diff/1/charm/dir.go#newcode61 charm/dir.go:61: fis, err := ioutil.ReadDir(dir.join("hooks")) On 2012/10/18 12:42:37, fwereade wrote: ...
11 years, 6 months ago (2012-10-18 13:35:20 UTC) #4
niemeyer
LGTM assuming the following: https://codereview.appspot.com/6734046/diff/4001/charm/charm.go File charm/charm.go (right): https://codereview.appspot.com/6734046/diff/4001/charm/charm.go#newcode52 charm/charm.go:52: if strings.HasPrefix(path, filepath.Join("hooks", "juju-")) { ...
11 years, 6 months ago (2012-10-19 01:07:03 UTC) #5
fwereade
11 years, 6 months ago (2012-10-19 07:22:09 UTC) #6
*** Submitted:

charm: disallow juju-* hooks on read

R=
CC=
https://codereview.appspot.com/6734046

https://codereview.appspot.com/6734046/diff/4001/charm/charm.go
File charm/charm.go (right):

https://codereview.appspot.com/6734046/diff/4001/charm/charm.go#newcode52
charm/charm.go:52: if strings.HasPrefix(path, filepath.Join("hooks", "juju-")) {
On 2012/10/19 01:07:03, niemeyer wrote:
> The path is coming from a zip file, which may be put together in different
ways,
> and in theory will use slashes no matter what the local convention is.
> 
> I suggest using *path*.Clean, and then checking for the "hooks/juju-" prefix.

Done.

https://codereview.appspot.com/6734046/diff/4001/charm/charm.go#newcode53
charm/charm.go:53: return fmt.Errorf("reserved hook name %q", path)
On 2012/10/19 01:07:03, niemeyer wrote:
> s/name/name:/

This doesn't feel consistent with what I've been asked to do elsewhere... I had
developed an understanding that a colon indicated that the bits following are
intended to be the *reason* for the error, rather than just, er, random
supplementary data. So "blah: inconsistent state" is fine, but `invalid whatever
"bar"` is better for that situation. I guess there's some nuance I'm missing...
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b