Is there a way for Watchman to only process "closed/completed" files? - windows

I'm using Node.js to start Watchman on Windows 2016 with a number of file type filters on a specific directory. This directory is being used for staging. Uploaded files will be routed to other folders depending on the filename.
The problem that I'm having is Watchman is picking up files that are being uploaded. It causes the moving processes to fail as it's locked. I'm thinking about using this package to check the file status (#ronomon/opened) before marking it as a candidate for moving. Is there a better way to do it?
Thanks,
Paul

Please take a look at this issue that sounds almost identical to your question; it has some other alternatives and details beyond what I've put below: https://github.com/facebook/watchman/issues/562#issuecomment-355450096
Summarizing that issue here: you need to allow for the filesystem to settle. There is a settle option you can set in your .watchmanconfig to control this:
{"settle": 60000}
You'd place that file in the upload directory (and make sure that you don't mistake it for an uploaded file and move it out) and then re-create your watch.

Related

I have a bunch of files in my stage area which is causing issues and I don't know how to remove them

I was working on a static website and decided to change my account as I recently changed my Github username. When I say account, I mean the icon in the bottom left corner of VS Code. In doing so, 10k files were added, and all my extensions disappeared.
The staged files include App Data files that I can't clear.
My Discord is affected. I can't open it as when I do, a message comes up and says:
'update.exe' has been moved or changed. Would you like to delete the shortcut?
Although it's an issue, I essentially have to reinstall it, but the same issue may still arise, which it has as I've tried reinstalling it.
My concern is I feel I may affect other programs by trying to come up with a solution.
I'm posting this question to get help on removing the 10k files that are staged and do not affect program files/app data. When I try to commit these files, I get an error saying,
Git Fatal :pathsepc C\Users.....\getconfig did not match any files
I would think all I need to do is add these files to a gitignore file, but I would need steps if so.
I hope I've explained my problem clearly to get a solution.
Please help.
Staged files

TF400889 Long path error received from TFS

Can someone please help me out with this? I tried using long path tool but they want me to pay in order to delete the folder. However I cant find the file the system is complaining about. I went to the folder
C:\Users\Casey\Desktop\Workspace\LegalHoldings\Sprints\Sprint5\Expunctions\LegalHoldings.Expunctions.Service.External\ServiceReferences\FillingReviewMDEService\LegalHoldings.Expunctions.Service.External.FilingReviewMDEService.GetFeesCalculationsResponse.datasource
This file:
FilingReviewMDEService.GetFeesCalculationsResponse.datasource
Does not exist in the folder?!?!?!
I don't know what to do, I have been reading a lot of work-arounds online however most people suggest using long path tool but I remember having this issue in the past but I cant remember how I solved. I believed it was something to do with the Developer Command prompt and resetting some paths.
All help would be greatly appreciated
In VS/TFS 2012, I found this helpful:
[Open TFS Explorer] -> [Right click the root folder] -> Advanced->'Remove Mapping...'
Then, you can change the path:
HTH
Usually these problems can be solved by shortening the paths higher up the tree.
It looks like your local path is the problem, so try mapping your code to a shorter root folder (e.g. C:\code rather than c:\users\Casey\desktop\workspace...)
Alternatively, you may be able to rename some mid level folders in your tfs structure to shorten the paths. But that's more extreme and probably not necessary in this case.
Not sure if you're even using the data binding features which the .datasource file is generated for, but turning that off in your service reference configuration by manually editing the .svcmap file would solve your problem.
After editing make sure you use the Update Reference feature to get rid of the unwanted file:
The second step would be to not map $/ to your user profile in your workspace mapping, but $LegalHoldings/Sprints/Sprint5/Expunctions to something like C:\Workspace\Sprint5 specifically that would drastically reduce the path depth required for your project.
If TFS still has a pending change for this file, you can use the tf utility from your workspace folder
C:\Users\Casey\Desktop\Workspace\LegalHoldings> tf undo $LegalHoldings/Sprints/Sprint5/Expunctions/LegalHoldings.Expunctions.Service.External/ServiceReferences/FillingReviewMDEService/LegalHoldings.Expunctions.Service.External.FilingReviewMDEService.GetFeesCalculationsResponse.datasource
to get rid of the pending change.

Duplicate PHP files in Magento installation?

A client's Magento site had weird characters in the top of Magento Connect:
We tried installing a plugin and got the following error:
It turns out the problem was a bunch of (hidden) duplicate PHP files in lib/Mage/Connect. For example, there's Remote.php but there was also ._Remote.php. This forum post was how we found out the details.
(Deleting the duplicate files corrected the problem).
I'm wondering -- has anyone else experienced this duplicate PHP file problem in Magento before? Any idea what the cause is?
These files are mostly likely meta-data files for OS X's HFS+ file system. See this entire thread on the Apple Stack Exchange for some good starting points if you're interested in the details.
Oversimplifying things, when you create a tar archive on OS X these files are included along with the "real" file. This allows Macintosh specific meta data to survive the trip into a file format that wasn't created specifically for the Mac. If you untar the files on a Mac, the meta-data is preserved. If you untar the files on a non-Mac, the ._ files are generated in case the meta data is needed.
My guess is, at some point someone tared up those files to move them to the production server from their Mac, which brought along the the ._ files for the ride. You can avoide this in the future by running
export COPYFILE_DISABLE=true
from the terminal prior to copying the files. Details on this here.
(It's pretty bizarre that PHP would attempt to include those files instead of the correct files — did you debug this far enough to know why/what connect through it was doing?)

windows hard link - protect against writes

I have a bunch of files that I download at some point and then customize. I want to keep the originals, but also allow modifications, and I want to do this using hard links.
I figure I first download the batch of files into some sort of repository, then create hard links into my work location. I want to let the user delete his files (e.g. delete the hard link), which doesn't pose problems.
However I also want to let him write to them, in which case I want my original file to be left untouched in the repository, so I can revert later. How can I do this transparently, without actually locking the file and forcing him to delete it and recreate it?
Any ideas greatly appreciated, thanks.
Cosmin
In windows you have no such option as NTFS/FAT doesn't support snapshots. Hard links are just links anyway, both point to a single file and if link A is changed link B is changed also.
You can partially achive the same result with Windows File History however I don't know any way to set it up exaclty as you described.

Storing file permissions in Subversion repository

How do you store file permissions in a repository? A few files need to be read-only to stop a third party program from trashing it but after checking out of the repository they are set to read-write.
I looked on google and found a blog post from 2005 that states that Subversion doesn't store file-permissions. There are patches and hook-scripts listed (only one url still exists). Three years later does Subversion still not store file permissions and are hooks the only way to go about this? (I've never done hooks and rather use something that is native to Subversion.)
SVN does have the capability of storing metadata (properties) along with a file. The properties are basically just key/value pairs, however there are some special keys like the 'svn:executable', if this property exists for a file, Subversion will set the filesystem's executable bit for that file when checking the file out. While I know this is not exactly what you are looking for it might just be enough (was for me).
There are other properties for line ending (svn:eol-style) and mime type(svn:mime-type).
There's no native way to store file permissions in SVN.
Both asvn and the patch from that blog post seem to be up (and hosted on the official SVN repository), and that's a good thing, but I don't think they will have such metadata handling in the core version any time soon.
SVN has had the ability to handle symbolic links and executables specially for a long while, but neither work properly on Win32. I wouldn't hold my breath for another such non-portable feature (though it wouldn't be too hard to implement on top of the already existing metadata system.)
I would consider writing a shell script to manually adjust file permissions, then putting it in the repository.
One possible solution would be to write a script that you check in with the rest of your code and which is run as the first step of your build process.
This script runs through your copy of the codebase and sets read permissions on certain files.
Ideally the script would read the list of files from a simple input file.
This would make it easy to maintain and easy for other developers to understand which files get marked as read-only.
Since this wasn't fully said in previous responses yet. I hate to resurrect zombied threads though.
Since adding permission support for SVN would have to accommodate multiple OS's and permission types, NFS, POSIX, ARWED, and RACF
This would make SVN bloated, possibly clash with conflicting permission types like NFS and POSIX, or open up possible exploits/security vulnerabilities.
There are a couple of workarounds.
pre-commit, post-commit, start-commit are the more commonly used, and are a part of the Subversion system.
But will allow you to control the permissions with what ever programming language you like.
The system I implemented is what I call a packager, that validates the committed files of the working copy, then parses a metadata file, which lists out the default permissions desired for files/folders, and any changes to them you also desire.
Owner, Group, Folders, Files
default: <user> www-user 750 640
/path/to/file: <user> non-www 770 770
/path/to/file2: <user> <user> 700 700
You can also expand upon this and allow things such as automated moving, renaming them, tagging revision by types, like alpha, beta, release candidate, release
As far as supporting clients to checkout your repository files with permissions attached to them. You are better off looking into creating an installer of your package and offering that as a resource.
Imagine people setting their repositories with an executable in it set with permissions of root:www-user 4777
This is the updated link for SVN patch which handles unix style file permissions correctly. I have tested out on fedora12 and seems to work as expected:
I just saved it /usr/bin/asvn and use asvn instead of svn command if i need permissions handled correctly.
Many answers have stated that svn does not store file permissions. This may be true, but I was able to solve a dll file without execute permissions problem simply by these steps:
chmod 755 badpermission.dll
mv badpermission.dll ../
svn update
svn rm badpermission.dll
svn commit badpermission.dll -m "Remove dll to fix permissions"
mv ../badpermission.dll .
svn add badpermission.dll
svn commit badpermission.dll -m "Add the dll back to fix permissions"
rm badpermission.dll
svn update
badpermission.dll comes back with execute permissions
#morechilli:
The asvn wrapper from my earlier post and the blog in the OP's post seems to do what you're suggesting. Though it stores the permissions in the corresponding files' repository properties as opposed to a single external file.
I would recommend to generate permissions map using mtree utility (FreeBSD has it by default), store the map in the repository, and, as was mentioned above, run a script that would restore proper file permissions from the map as the first step of the build process.
Locking would not solve this problem. Locking stops others from editing the file. This is a third party application which gets run as part of the build process that tries to write to a file - changing it - which breaks the build process. Therefore we need to stop the program from changing the file which is simply marking the file read-only. We would like that information to be held in the repository and carried across checkins, branches, etc.
Graham, svn doesn't store permissions. Your only option is to wrap your call to svn in a script. The script should call svn with its arguments, then set the permissions afterward. Depending on your environment, you might need to call your script svn and tweak your PATH to ensure it gets called.
I quite like morechilli's idea to have the list of files and permissions checked into the repository itself.
We created a batch file to do this for us. Would prefer actual support in subversion though...
Consider using svn lock to disallow others from writing to the file.

Resources