Skip to content

[BUG] store copy/store info: --rewrite strips library/ but it is silently re-added, making the rewrite a no-op #681

Description

@hierynomus

Environmental Info:

root@production:~# uname -a
Linux production 6.12.0-160000.35-default #1 SMP PREEMPT_DYNAMIC Wed Jun 10 13:35:47 UTC 2026 (c70d539) x86_64 x86_64 x86_64 GNU/Linux

Hauler Version:

root@production:~# hauler version
 __    __       ___       __    __   __       _______ .______
|  |  |  |     /   \     |  |  |  | |  |     |   ____||   _  \
|  |__|  |    /  ^  \    |  |  |  | |  |     |  |__   |  |_)  |
|   __   |   /  /_\  \   |  |  |  | |  |     |   __|  |      /
|  |  |  |  /  _____  \  |  `--'  | |  `----.|  |____ |  |\  \----.
|__|  |__| /__/     \__\  \______/  |_______||_______|| _| `._____|
hauler: Airgap Swiss Army Knife

GitVersion:    devel
GitCommit:     unknown
GitTreeState:  unknown
BuildDate:     unknown
GoVersion:     go1.26.4
Compiler:      gc
Platform:      linux/amd64
root@production:~# zypper --no-refresh info hauler
Loading repository data...
Reading installed packages...


Information for package hauler:
-------------------------------
Repository     : repo-oss (16.0)
Name           : hauler
Version        : 2.0.1-bp160.1.1
Arch           : x86_64
Vendor         : openSUSE
Installed Size : 154.8 MiB
Installed      : Yes
Status         : up-to-date
Source package : hauler-2.0.1-bp160.1.1.src
Upstream URL   : https://github.com/hauler-dev/hauler
Summary        : Airgap Swiss Army Knife

Describe the Bug:

When using --rewrite to strip the Docker Hub library/ prefix from an official image, e.g.

hauler store add image busybox --rewrite busybox

Hauler logs the rewrite correctly but the image is stored and later copied under the original library/ path. The rewrite appears as a no-op.

Steps to Reproduce:

root@production:~# hauler store add image busybox --rewrite busybox
2026-07-20 15:06:43 INF adding image [busybox] to the store
2026-07-20 15:06:53 INF rewriting [index.docker.io/library/busybox:latest] to [index.docker.io/busybox:latest]
2026-07-20 15:06:53 INF successfully added image [index.docker.io/library/busybox:latest]

root@production:~# hauler store info
┌────────────────────────────────────────┬───────┬─────────────────┬───────────┬──────────┐
│ REFERENCE                              │ TYPE  │ PLATFORM        │ #  LAYERS │ SIZE     │
├────────────────────────────────────────┼───────┼─────────────────┼───────────┼──────────┤
│ index.docker.io/library/busybox:latest │ image │ linux/386       │ 1         │ 2.3 MB   │
└────────────────────────────────────────┴───────┴─────────────────┴───────────┴──────────┘

root@production:~# hauler store copy oci://myregistry.io
# image is pushed to myregistry.io/library/busybox:latest
# expected: myregistry.io/busybox:latest

Expected Behavior:

  • store info shows index.docker.io/busybox:latest (no library/)
  • store copy pushes to myregistry.io/busybox:latest (no library/)

Actual Behavior:

The library/ prefix is present on both operations.

Additional Context:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    To Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions