Giter Club home page Giter Club logo

Comments (4)

jonashoechst avatar jonashoechst commented on August 11, 2024

I've created a small example to recreate the behavior, but was not able to reproduce the error:

FROM http://downloads.openwrt.org/releases/18.06.5/targets/brcm2708/bcm2710/openwrt-18.06.5-brcm2708-bcm2710-rpi-3-ext4-factory.img.gz

# test size of the image
RUN sh -c "
    echo hello
    echo world
"

from pimod.

jonashoechst avatar jonashoechst commented on August 11, 2024

sh of OpenWRT is kind of a special case and does not reproduce the problem clear enough. When using bash -c the error can be reproduces even in OpenWRT.

from pimod.

jonashoechst avatar jonashoechst commented on August 11, 2024

A central conceptual problem is that printf ' %q' does format the input as bash-escaped string. When supplying these strings to sh, misinterpretations can occur and seem to have happened here.

In the OpenWRT example /bin/sh supports the requested formatting options, but the Debian (vanilla) /bin/sh did not support the format string.

A discussion of the probem can be found here: https://stackoverflow.com/questions/12162010/posix-sh-equivalent-for-bash-s-printf-q

A workaround through reformatting the printf's output is implemented here: https://github.com/mentalisttraceur/esceval/blob/master/sh/esceval.sh

from pimod.

jonashoechst avatar jonashoechst commented on August 11, 2024

PATH=${GUEST_PATH} chroot "${CHROOT_MOUNT}" \
/bin/sh -c "cd ${WORKDIR_PATH}; $(printf ' %q' "$@")"

Following the current implementation the guest OS requires /bin/sh to exist and to support the requested format. This additional shell could be circumvented, if there was a chroot option to specify a chdir, because cd inside this additional shell would not be required.

As there is no such option, a custom chroot patch could be useful here.

from pimod.

Related Issues (20)

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.