GithubHelp home page GithubHelp logo

isabella232 / dockerignore-wildcard-bug Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tilt-dev/dockerignore-wildcard-bug

0.0 0.0 0.0 6 KB

Demonstrates a bug in dockerignore wildcards (**)

License: Apache License 2.0

Dockerfile 58.44% Makefile 41.56%

dockerignore-wildcard-bug's Introduction

dockerignore-wildcard-bug

Demonstrates a bug in dockerignore wildcards (**)

Repro steps:

Checkout this directory and run make all

Expected result:

include.txt should be in the docker context.

exclude.txt should be ignored.

Actual result:

Both are included in the docker context.

Other notes

The underlying bug is this code:

https://github.com/moby/moby/blob/v19.03.12/pkg/fileutils/fileutils.go#L83

which assumes that the number of directory separators in the pattern can be used to determine the "directory" length, which is not a correct assumption when wildcards are present.

Interestingly, the exclude pattern is necessary to reproduce this problem. That's because this code:

https://github.com/moby/moby/blob/v19.03.12/pkg/archive/archive.go#L843

skips directories purely as an optimization. Adding an exclusion pattern (!a/b/c/include.txt) makes this code go down the "slow" codepath.

dockerignore-wildcard-bug's People

Contributors

nicks avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.