Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed a manifest into git.exe #33

Merged
merged 1 commit into from
Mar 9, 2015
Merged

Conversation

dscho
Copy link
Member

@dscho dscho commented Mar 9, 2015

Just like it is done in https://github.com/git-for-windows/MSYS2-packages/blob/master/git/git-1.9.0-manifest-msys2.patch, we should embed the manifest by default (instead of using external .manifest files, as we used to).

That linked patch should be simplified a little bit, e.g. by adding $(RESOURCE_OBJS) to $(GITLIBS) to avoid touching so many lines at once.

@dscho
Copy link
Member Author

dscho commented Mar 9, 2015

Wohoo! Turned the issue into a Pull Request with this trick:

curl --netrc -X POST --data '{"issue": "33", "head": "dscho:manifest", "base": "master", \
    "head_sha": "7342b43b41c31b0ed24386953f084e3edf1add7d", \
    "base_sha": "3cd528c49dcaa541fa901362f3049c1acc7e52df"}' \
  https://api.github.com/repos/git-for-windows/git/pulls

@sschuberth @t-b could you have a look and merge if you have no objections?

@sschuberth
Copy link

It's a pity that we cannot add line comment to the commit message in GitHub.

@dscho: I figure the "jes" part in the commit message comes from your? Should it better say "js" instead?

Also, the commit message speaks about built-ins being hard-linked. With #34 this would not be the case anymore. Maybe add a sentence to your comment accounting for that? EDIT: Oh, I see, the latter is an issue, not a PR for now. So not talking about the git-wrapper before we take it into use to replace built-ins is fine with me.

Which brings be to the question: Don't we need this manifest for the git-wrapper executable then, too?

On Windows >= Vista, not having an application manifest with a
requestedExecutionLevel can cause several kinds of confusing behavior.

The first and more obvious behavior is "Installer Detection", where
Windows sometimes decides (by looking at things like the file name and
even sequences of bytes within the executable) that an executable is an
installer and should run elevated (causing the well-known popup dialog
to appear). In Git's context, subcommands such as "git patch-id" or "git
update-index" fall prey to this behavior.

The second and more confusing behavior is "File Virtualization". It
means that when files are written without having write permission, it
does not fail (as expected), but they are instead redirected to
somewhere else. When the files are read, the original contents are
returned, though, not the ones that were just written somewhere else.
Even more confusing, not all write accesses are redirected; Trying to
write to write-protected .exe files, for example, will fail instead of
redirecting.

In addition to being unwanted behavior, File Virtualization causes
dramatic slowdowns in Git (see for instance
http://code.google.com/p/msysgit/issues/detail?id=320).

There are two ways to prevent those two behaviors: Either you embed an
application manifest within all your executables, or you add an external
manifest (a file with the same name followed by .manifest) to all your
executables. Since Git's builtins are hardlinked (or copied), it is
simpler and more robust to embed a manifest.

A recent enough MSVC compiler should already embed a working internal
manifest, but for MinGW you have to do so by hand.

Very lightly tested on Wine, where like on Windows XP it should not make
any difference.

References:
  - New UAC Technologies for Windows Vista
    http://msdn.microsoft.com/en-us/library/bb756960.aspx
  - Create and Embed an Application Manifest (UAC)
    http://msdn.microsoft.com/en-us/library/bb756929.aspx

[js: simplified the embedding dramatically by reusing Git for Windows'
existing Windows resource file, removed the optional (and dubious)
processorArchitecture attribute of the manifest's assemblyIdentity
section.]

Signed-off-by: Cesar Eduardo Barros <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
@dscho
Copy link
Member Author

dscho commented Mar 9, 2015

Don't we need this manifest for the git-wrapper executable then, too?

Absolutely.

I figure the "jes" part in the commit message comes from your? Should it better say "js" instead?

Fixed.

@sschuberth
Copy link

Thanks!

sschuberth added a commit that referenced this pull request Mar 9, 2015
Embed a manifest into git.exe
@sschuberth sschuberth merged commit e9a2fe0 into git-for-windows:master Mar 9, 2015
@dscho dscho deleted the manifest branch March 9, 2015 09:34
dscho added a commit that referenced this pull request Mar 21, 2015
Embed a manifest into git.exe
dscho pushed a commit that referenced this pull request Mar 24, 2015
Embed a manifest into git.exe
jeffhostetler pushed a commit to jeffhostetler/git that referenced this pull request Oct 10, 2018
…ectory is included

Add check to see if a directory is included in the virtualfilesystem
before checking the directory hashmap. This allows a directory entry
like foo/ to find all untracked files in subdirectories.
jamill pushed a commit to jamill/git that referenced this pull request Nov 20, 2018
…rectory is included

Add check to see if a directory is included in the virtualfilesystem
before checking the directory hashmap. This allows a directory entry
like foo/ to find all untracked files in subdirectories.
jeffhostetler pushed a commit to jeffhostetler/git that referenced this pull request Jun 3, 2020
Add virtual file system settings and hook proc.  On index load,
clear/set the skip worktree bits based on the virtual file system data.
Use virtual file system data to update skip-worktree bit in
unpack-trees. Use virtual file system data to exclude files and folders
not explicitly requested.

The hook was first contributed in private, but was extended via the
following pull requests:

	git-for-windows#15
	git-for-windows#27
	git-for-windows#33
	git-for-windows#70

Signed-off-by: Ben Peart <[email protected]>
Signed-off-by: Derrick Stolee <[email protected]>
jeffhostetler pushed a commit to jeffhostetler/git that referenced this pull request May 14, 2021
Add virtual file system settings and hook proc.  On index load,
clear/set the skip worktree bits based on the virtual file system data.
Use virtual file system data to update skip-worktree bit in
unpack-trees. Use virtual file system data to exclude files and folders
not explicitly requested.

The hook was first contributed in private, but was extended via the
following pull requests:

	git-for-windows#15
	git-for-windows#27
	git-for-windows#33
	git-for-windows#70

Signed-off-by: Ben Peart <[email protected]>
Signed-off-by: Derrick Stolee <[email protected]>
jeffhostetler pushed a commit to jeffhostetler/git that referenced this pull request Jun 21, 2021
Add virtual file system settings and hook proc.  On index load,
clear/set the skip worktree bits based on the virtual file system data.
Use virtual file system data to update skip-worktree bit in
unpack-trees. Use virtual file system data to exclude files and folders
not explicitly requested.

The hook was first contributed in private, but was extended via the
following pull requests:

	git-for-windows#15
	git-for-windows#27
	git-for-windows#33
	git-for-windows#70

Signed-off-by: Ben Peart <[email protected]>
Signed-off-by: Derrick Stolee <[email protected]>
jeffhostetler pushed a commit to jeffhostetler/git that referenced this pull request Aug 18, 2021
Add virtual file system settings and hook proc.  On index load,
clear/set the skip worktree bits based on the virtual file system data.
Use virtual file system data to update skip-worktree bit in
unpack-trees. Use virtual file system data to exclude files and folders
not explicitly requested.

The hook was first contributed in private, but was extended via the
following pull requests:

	git-for-windows#15
	git-for-windows#27
	git-for-windows#33
	git-for-windows#70

Signed-off-by: Ben Peart <[email protected]>
Signed-off-by: Derrick Stolee <[email protected]>
mjcheetham pushed a commit to mjcheetham/git that referenced this pull request Jun 16, 2022
Add virtual file system settings and hook proc.  On index load,
clear/set the skip worktree bits based on the virtual file system data.
Use virtual file system data to update skip-worktree bit in
unpack-trees. Use virtual file system data to exclude files and folders
not explicitly requested.

The hook was first contributed in private, but was extended via the
following pull requests:

	git-for-windows#15
	git-for-windows#27
	git-for-windows#33
	git-for-windows#70

Signed-off-by: Ben Peart <[email protected]>
Signed-off-by: Derrick Stolee <[email protected]>
mjcheetham pushed a commit to mjcheetham/git that referenced this pull request Jul 23, 2024
Add virtual file system settings and hook proc.  On index load,
clear/set the skip worktree bits based on the virtual file system data.
Use virtual file system data to update skip-worktree bit in
unpack-trees. Use virtual file system data to exclude files and folders
not explicitly requested.

The hook was first contributed in private, but was extended via the
following pull requests:

	git-for-windows#15
	git-for-windows#27
	git-for-windows#33
	git-for-windows#70

Signed-off-by: Ben Peart <[email protected]>
Signed-off-by: Derrick Stolee <[email protected]>
mjcheetham pushed a commit to mjcheetham/git that referenced this pull request Jan 20, 2025
Add virtual file system settings and hook proc.  On index load,
clear/set the skip worktree bits based on the virtual file system data.
Use virtual file system data to update skip-worktree bit in
unpack-trees. Use virtual file system data to exclude files and folders
not explicitly requested.

The hook was first contributed in private, but was extended via the
following pull requests:

	git-for-windows#15
	git-for-windows#27
	git-for-windows#33
	git-for-windows#70

Signed-off-by: Ben Peart <[email protected]>
Signed-off-by: Derrick Stolee <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants