Skip to content

MachO: possible issue when resizing? #1204

@LecrisUT

Description

@LecrisUT

In case you don't get notifications on closed issues, I am reposting this as a new issue.

I am hitting the warning "Not enough room left to rebuild" and I am not sure if we are supposed to resize it manually or it does it for us. Afaict from the implementation it is the latter.

But then, regarding the test introduced in 402e7a9, shouldn't the new paths be bigger than the current ones to check that the rebuilding works

assert rpaths[0].path == "/tmp"
assert rpaths[1].path == "/var"
rpaths[0].path = "/foo"
rpaths[1].path = "/bar"

something like

    rpaths[0].path = "@loader_path/some/very/long/path/that/will/trigger/not/enough/room/to/rebuild"
    rpaths[1].path = "/bar"

Let me know if I got this wrong and it is supposed to be used differently. For context, I am trying to do something along the lines

            import lief.MachO

            fat_macho = lief.MachO.parse(artifact)
            for macho_it in range(fat_macho.size):
                macho = fat_macho.at(macho_it)
                macho.remove(lief.MachO.LoadCommand.TYPE.RPATH)
                for rpath in final_rpaths:
                    macho_rpath = lief.MachO.RPathCommand.create(rpath)
                    macho.add(macho_rpath)
            fat_macho.write(str(artifact))

Originally posted by @LecrisUT in #1074

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions