Skip to content

Commit 03012f9

Browse files
committed
[FAB-7434] Normalize UID/GID in cc packages
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>
1 parent c0f7f56 commit 03012f9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

core/container/util/writer.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ func WriteStreamToPackage(is io.Reader, localpath string, packagepath string, tw
153153
header.ChangeTime = zeroTime
154154
header.Name = packagepath
155155
header.Mode = 0100644
156+
header.Uid = 500
157+
header.Gid = 500
156158

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

0 commit comments

Comments
 (0)