Skip to content

Commit

Permalink
[FAB-7434] Normalize UID/GID in cc packages
Browse files Browse the repository at this point in the history
When creating a chaincode package, if
one uses the same code but it happens
to be owned by a different user/group,
a different package is produced and this
can result in a fingerprint mismatch
at instantiate time.

While people should actually install the
same package and not individually create
their own packages, creating packages
given identical inputs/code should be
repeatable on different machines so
this CR simply normalizes the UID/GID
when adding files to the archive.

Change-Id: I04b6ddde00bc80d98cf55de66ae9ff005f6b2aa7
Signed-off-by: Gari Singh <gari.r.singh@gmail.com>
  • Loading branch information
mastersingh24 committed Dec 12, 2017
1 parent c0f7f56 commit 03012f9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/container/util/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ func WriteStreamToPackage(is io.Reader, localpath string, packagepath string, tw
header.ChangeTime = zeroTime
header.Name = packagepath
header.Mode = 0100644
header.Uid = 500
header.Gid = 500

if err = tw.WriteHeader(header); err != nil {
return fmt.Errorf("Error write header for (path: %s, oldname:%s,newname:%s,sz:%d) : %s", localpath, oldname, packagepath, header.Size, err)
Expand Down

0 comments on commit 03012f9

Please sign in to comment.