github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/internal/build/moby/archive_windows.go (about)

     1  package moby
     2  
     3  // Adapted from
     4  // https://github.com/moby/moby/blob/ecb898dcb9065c8e9bcf7bb79fd160dea1c859b8/pkg/archive/archive_windows.go
     5  
     6  /*
     7     Copyright 2013-2018 Docker, Inc.
     8  
     9  Licensed under the Apache License, Version 2.0 (the "License");
    10  you may not use this file except in compliance with the License.
    11  You may obtain a copy of the License at
    12  
    13  	https://www.apache.org/licenses/LICENSE-2.0
    14  
    15  Unless required by applicable law or agreed to in writing, software
    16  distributed under the License is distributed on an "AS IS" BASIS,
    17  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    18  See the License for the specific language governing permissions and
    19  limitations under the License.
    20  */
    21  
    22  import (
    23  	"os"
    24  )
    25  
    26  // chmodTarEntry is used to adjust the file permissions used in tar header based
    27  // on the platform the archival is done.
    28  func ChmodTarEntry(perm os.FileMode) os.FileMode {
    29  	// perm &= 0755 // this 0-ed out tar flags (like link, regular file, directory marker etc.)
    30  	permPart := perm & os.ModePerm
    31  	noPermPart := perm &^ os.ModePerm
    32  	// Add the x bit: make everything +x from windows
    33  	permPart |= 0111
    34  	permPart &= 0755
    35  
    36  	return noPermPart | permPart
    37  }