Git: AWK inplace

Created on 9 Dec 2018  ·  18Comments  ·  Source: git-for-windows/git

Win 7 x64, v2.20.0-rc2.windows

$ awk --version
GNU Awk 4.2.1, API: 2.0 (GNU MPFR 4.0.1, GNU MP 6.1.2)

$ awk -i inplace '{ gsub(/foo/, "bar") }; { print }' file1
awk: fatal: can't open source file `inplace' for reading (No such file or directory)

Why _inplace_ is still (end of 2018) not working as expected?

bug msys2 question up for grabs

Most helpful comment

There are no daily builds, but there are snapshot builds. These might be instable.

You could probably also get this functionality by copying inplace.awk into /usr/share/awk in your current portable install.

The next release will likely be in early june, a few days after upstream releases 2.22.0.

Edit: Seeing as there is a v2.21.0(2) milestone the next release might be earlier.

All 18 comments

You got me at a loss here:

  • what is that -i inplace supposed to do?
  • is this a feature that is supposed to be part of GNU awk v4.2.1?
  • what does this have to do with Git?

@sergeevabc so you do not want to answer those questions, but instead just throw two links at me? ;-)

Since you were so happy to not help me but instead put the burden on me to find out, I'll return the favor by pointing out that your own link, https://www.gnu.org/software/gawk/manual/html_node/Extension-Sample-Inplace.html, explains what needs to happen: the inplace.awk file will need to be bundled. It is bundled, however, so it will now be your honor (if you had been more forthcoming and less willing to try to leave all the work to me, I would have helped) to figure out why it is not found.

With git v2.20 I can't see inplace.awk installed, awk is looking for it under C:\Program Files\Git\usr\share\awk\inplace.awk

On Thu, 13 Dec 2018, İsmail Dönmez wrote:

With git v2.20 I can't see inplace.awk installed, awk is looking for it under C:\Program Files\Git\usr\share\awk\inplace.awk

This is the correct location to look for, and that is where the file is also in Git for Windows' SDK: https://github.com/git-for-windows/git-sdk-64/tree/master/usr/share/awk/

But you're right, in the end-user installation, the file is missing (actually, the entire /usr/share/awk/ folder). The reason is probably some overzealous exclusion in https://github.com/git-for-windows/build-extra/blob/master/make-file-list.sh

Here is how you can help:

  1. Build your own Git for Windows installer, as per https://github.com/git-for-windows/git/wiki/Making-an-installer
  2. see whether you can find the offending exclusion in make-file-list.sh (it lives in /usr/src/build-extra/ in the SDK)
  3. Change it (probably delete the line, but maybe it is just part of a line), and test whether it fixes it: BITNESS=64 ARCH=x86_64 /usr/src/build-extra/make-file-list.sh | grep inplace.awk
  4. Once your fix works, commit, push and open a Pull Request.

Problematic line seems to be https://github.com/git-for-windows/build-extra/blob/master/make-file-list.sh#L115, if anyone fixes it before me would be fine too ;)

Problematic line seems to be https://github.com/git-for-windows/build-extra/blob/master/make-file-list.sh#L115,

The first part of it, yes.

People! My people! This outline is not too hard to follow, is it?

Or do you not want that inplace thing anymore? I guess that's it. Well, then.

Err… Mere Windows user here, not a developer. Cannot fix it myself and then open a pull request.

@dscho I've found this feature to be useful from time to time, although as of yet I haven't needed it when using Git for Windows specifically. I'll take a crack at this item.

@sergeevabc have you even read https://github.com/git-for-windows/git/issues/1972#issuecomment-447289140 ? Nobody asked you to develop anything. It is a heck of a lot easier to modify something existing, especially with a detailed list of steps to follow. Not even trying is... well, I lack the words to describe this politely.

@landstander668 thanks.

I checked PortableGit-2.21.0-64-bit.7z.exe dated 2019-02-27, but its AWK is still not able to work inplace. Would someone be so kind to point at the exact location of Windows binary of modified AWK, please?

@sergeevabc This fix should be included in the next release of Git for Windows. Since no release has occurred since PR was merged, however, there isn't currently an official installer (or portable release) which incorporates the update.

I don't believe this project publishes daily builds, so for now it's necessary to install the SDK and build an installer / portable build if you need this item.

@landstander668, thank you for a thorough explanation, sir.
Then I subscribe by means of “Watch/Releases only”.

There are no daily builds, but there are snapshot builds. These might be instable.

You could probably also get this functionality by copying inplace.awk into /usr/share/awk in your current portable install.

The next release will likely be in early june, a few days after upstream releases 2.22.0.

Edit: Seeing as there is a v2.21.0(2) milestone the next release might be earlier.

@rimrul, snapshot build contains AWK which is able to do inplace edits, hooray! but only when folders structure kept intact after unpacking with mandatory inplace.awk presence, otherwise AWK throws an error:

awk: fatal: can't open source file `inplace' for reading (No such file or directory)

Seeing as there is a v2.21.0(2) milestone the next release might be earlier.

Don't read too much into that, I always name the milestones conservatively. Unless there is an important reason to do otherwise, the next official version of Git for Windows will be v2.22.0.

but only when folders structure kept intact after unpacking with mandatory inplace.awk presence

@sergeevabc what do you mean?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yegorich picture yegorich  ·  3Comments

kc22033 picture kc22033  ·  4Comments

Unknow0059 picture Unknow0059  ·  3Comments

rangka-kacang picture rangka-kacang  ·  3Comments

Jarmos-san picture Jarmos-san  ·  3Comments