cli icon indicating copy to clipboard operation
cli copied to clipboard

Applying a template affects the checksum of contained image files

Open TorbenWetter opened this issue 2 years ago • 4 comments

I want to express my sincere appreciation for making Dev Containers a reality; I've been a huge fan since its launch! Over the past few months, I've put together my own template, which can be found here: https://github.com/TorbenWetter/iu-latex-container-templates

The Problem

Up until now, everything has been running smoothly. Files with extensions like .tex or .bib have been effortlessly incorporated into my Dev Container. However, today I attempted to add image files to my thesis template, including .jpg and .png files. While loading the template in VS Code using Add Dev Container Configuration Files... from the Dev Containers extension, I observed that the hash/checksum of the image files differed from those in my template's GitHub repository. Regrettably, this discrepancy rendered them incompatible with my LaTeX environment. Although I wasn't able to delve into this issue further, I concentrated on examining the behaviour of the Dev Containers CLI.

Reproduction Process

In an attempt to discern what was occurring with the images, I cloned my repository, applied the template via the Dev Containers CLI, and then compared the checksums of the images:

$ cd /tmp

$ git clone --depth 1 --branch template_thesis_1.0.5 [email protected]:TorbenWetter/iu-latex-container-templates.git

$ mkdir thesis
$ devcontainer templates apply -w thesis -t ghcr.io/torbenwetter/iu-latex-container-templates/thesis:1.0.5

$ shasum iu-latex-container-templates/src/thesis/main.tex thesis/main.tex
cb9d6954c4fafcc143900163dc0006d9b650efc1  iu-latex-container-templates/src/thesis/main.tex
cb9d6954c4fafcc143900163dc0006d9b650efc1  thesis/main.tex

$ shasum iu-latex-container-templates/src/thesis/images/logo.png thesis/images/logo.png
09a00de3136176c036ab9c79583c5b796e9a7085  iu-latex-container-templates/src/thesis/images/logo.png
075e1ec15b02c54b843abf26db272a4f110c1a9e  thesis/images/logo.png

I'm more than willing to further investigate this issue, but so far, my independent attempts to pinpoint the problem with the CLI by scrutinizing the code have been fruitless.

TorbenWetter avatar Jul 21 '23 19:07 TorbenWetter

Hi 👋

Thanks for opening the issue and for your kind words ✨ @TorbenWetter what's the version of your @devcontainers/cli package? You can find it with devcontainer --version command.

@chrmarti Could this be related to the lockfile changes? or any other recent changes? 🤔

samruddhikhandale avatar Jul 21 '23 23:07 samruddhikhandale

Hey @samruddhikhandale!

I'm using the most recent version of the CLI:

$ devcontainer --version
0.50.0

Here's the version of VS Code I'm currently using:

  • Version: 1.80.1
  • Commit: 74f6148eb9ea00507ec113ec51c489d6ffb4b771
  • Date: 2023-07-12T17:20:58.115Z
  • Electron: 3/22/14
  • ElectronBuildId: 21893604
  • Chromium: 108.0.5359.215
  • Node.js: 16.17.1
  • V8: 10.8.168.25-electron.0
  • Operating system: Darwin arm64 23.0.0

What I couldn't confirm is whether the image files (.jpg/.png) undergo modifications during the build process itself, or when the template is applied by either VS Code or the CLI.

TorbenWetter avatar Jul 21 '23 23:07 TorbenWetter

Oh, and not to forget:

Dev Containers VS Code extension version v0.299.0.

TorbenWetter avatar Jul 21 '23 23:07 TorbenWetter

Found that we convert all files to text and back which does not preserve binary content and created a PR from my investigation.

chrmarti avatar Jul 24 '23 09:07 chrmarti