AgeCommit message (Collapse)AuthorFilesLines
2016-02-05pseudo_server.c: new clients cancel a shutdown requestPeter Seebach2-1/+7
If a SHUTDOWN message has caused us to set the "die_peacefully" flag, but there are new clients waiting, cancel the shutdown.
2016-02-05pseudo_client.c: don't abort on failure to start serverPeter Seebach2-6/+4
In some cases, there can be a race with multiple clients trying to start a server at once, and they should just retry their messages, rather than aborting. I haven't been able to consistently reproduce this, so it's not very well tested, but it seems reasonable.
2016-01-22Fix mknod(...) with no file type bitsPeter Seebach4-2/+18
mknod(2) automatically defaults to S_IFREG if not given an explicit file type, so pseudo should too. Otherwise, GNU tar can (for some reason, it mostly does this when extracting xattrs?) invoke mknod instead of open with O_CREAT to create a file, and just provide the permission bits, and pseudo creates a "weird file" with no type bits in the database, which is unhelpful. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-09-22f*open*: Use more-correct mode.pseudo-1.7.4PSEUDO_1_7_4Peter Seebach6-6/+9
The f{re,}open{64,} functions use a default mode of 0666 & ~umask, and defaulting to 0600 for the post-open chmod was breaking some use cases. Problem and solution identified by Ross Burton, I just made the local copy of the patch. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-09-04pseudo 1.7.3pseudo-1.7.3PSEUDO_1_7_3Peter Seebach2-1/+2
So fchmodat(..., AT_SYMLINK_NOFOLLOW) isn't valid, and could result in mkdirat/mkfifoat setting errno on success, which is mostly harmless except for one or two programs which consider a non-zero errno to be proof of failure. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-09-04Don't have mkdirat set errno unintentionallyPeter Seebach3-2/+10
mkdirat() was calling real_fchmodat with invalid arguments (it turns out that AT_SYMLINK_NOFOLLOW is both irrelevant and forbidden by Linux), and the wrapper function did not restore errno to its previous value. This breaks localedef, because localedef is unconditionally storing the value of errno after a mkdir *whether or not the mkdir failed*, which is almost certainly wrong. Similar issue with mkfifoat. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-09-04Add return value printing to wrappersPeter Seebach3-2/+33
I never did this because how could you do it generically, then a friend who is better at Python gave me an idea for a way to do it, and now wrapper debugging prints return values, not just errno values, in most-to-all cases. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-09-031.7.2 branchpseudo-1.7.2PSEUDO_1_7_2Peter Seebach2-1/+2
And another branch, for 1.7.2, because I think that'll be the last of it. Hah. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-09-03Finish (I hope) working around 0700 umasks.Peter Seebach8-5/+17
There's some changes to allow things to work even if umask is 0700; originally this was just regarded as a broken state, but it became necessary to fix it in order for the xattrdb code to work, only the fix could result in files having a raw filesystem mode that lacked execute bits it should have had. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-09-02pseudo 1.7.1pseudo-1.7.1PSEUDO_1_7_1Peter Seebach2-1/+5
Two little bug fixes. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-09-01realpath: allocate memory when null pointer givenPeter Seebach2-1/+3
When I trimmed the spurious free()s for the new lower-allocation path strategy, I forgot to look for cases where I was relying on the allocation, such as realpath(path, NULL). Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-09-01Don't use bare lstat.Peter Seebach3-8/+13
lstat can fail on XFS if the inode number won't fit in a 32-bit value. Use base_lstat. Also, just in case, don't call it if it's not initialized yet (which should never happen). Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-08-241.7.0 branchpseudo-1.7.0PSEUDO_1_7_0Peter Seebach1-0/+1
Performance cleanups including the experimental xattrdb feature. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-08-24Small cleanups in passingPeter Seebach4-42/+24
gcc is better about warnings and spotted variables being assigned but not used. Clever gcc. Cleaned up the old bits. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-08-24Some extra debugging bits.Peter Seebach3-3/+20
Add some debug messages useful for tracking down xattr behaviors. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-08-24xattrdb bug fixesPeter Seebach10-27/+82
When xattr emulation is used to store extended attributes, dummy entries get made in the db using whatever UID/GID were in the real stat buffer if no entry already existed. Change these to -1, and treat -1 uid/gid as a missing entry for stat purposes. xattrdb was not merging existing uid/gid values. Change this by loading existing values to merge them in when executing chown/chmod commands. Newly-created files could end up with a filesystem mode of 0 if you used umask, but this breaks xattrdb. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-08-21Mark dummy entries as dummiesPeter Seebach1-1/+21
When setting an extended attribute using the database, we create a dummy entry for the file (so there will be a file row corresponding to that path name for later lookups). But this entry was coming in with host UID/GID values in some cases. Instead, use -1 uid/gid, and have STAT report those as failures rather than as existing values. (Other cases should not be copying them. I think.) Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-08-21Clean up some const stuffPeter Seebach5-5/+5
Dropping the alloc from file paths meant that pseudo_exec_path could end up just returning its original argument, which was const-qualified, meaning its return should also be const-qualified. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-08-21Reduce unused message sendingPeter Seebach3-4/+19
OP_OPEN and OP_EXEC are used only when logging. The server can now tell the client (in response to initial ping) whether or not it is logging, and if it isn't, the client doesn't send those messages. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-08-21New option: Use extended attributes to store db values.Peter Seebach10-30/+242
This is a moderately experimental feature which stores values in an extended attribute called 'user.pseudo_data' instead of in the database. Still missing: Database<->filesystem synchronization for this. For at least some workloads, this can dramatically improve performance. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-08-20Drop the allocation in pseudo_fix_path/pseudo_root_path/etc.Peter Seebach16-86/+41
Instead of allocating (and then freeing) these paths all the time, use a rotating selection of buffers of fixed but probably large enough size (the same size that would have been the maximum anyway in general). With the exception of fts_open, there's no likely way to end up needing more than two or three such paths at a time. fts_open dups the paths since it could have a large number and need them for a while. This dramatically reduces (in principle) the amount of allocation and especially reallocation going on. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-08-20Initial profiling implementation.Peter Seebach18-67/+408
A partially-implemented profiler for client time, which basically just inserts (optional) gettimeofday calls in various places and stashes data in a flat file containing one data block per pid. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-07-171.6.7: fix mkfifopseudo-1.6.7PSEUDO_1_6_7Peter Seebach4-16/+72
Worked for trivial cases, but spuriously closed fd 0 and had other issues. Separated implementations out.
2015-07-161.6.6 (fifo and xattr improvements)pseudo-1.6.6PSEUDO_1_6_6Peter Seebach2-1/+2
2015-07-16Allow fifosPeter Seebach2-5/+14
Some years back, there was a historical reason (lost to the mists of time) for which we had problems if we allowed actual creation of fifos, but so far as we know we don't expect any problems with them now, and there's a bitbake change which would like to be able to use fifos for logging, so let's try enabling them and see what happens.
2015-07-16pseudo.c: Don't truncate xattr data.Peter Seebach2-7/+13
In the case where an "oldpath" is actually the data for an xattr operation, don't truncate it. Trailing slashes should only be removed from things which are actually filenames.
2015-05-04reduce spurious messages about trailing slashespseudo-1.6.5PSEUDO_1_6_5Peter Seebach3-2/+6
There was supposed to be a check for filenames showing up with a trailing slash when the file was not a directory. What actually made it in was a check for a mismatch between "is a directory" and "has trailing slash", which produced spurious messages saying the path had a trailing slash whenever a directory path did *not* have a trailing slash. But that's valid and should not produce diagnostics. Let alone thousands of diagnostics. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-01-22pseudo 1.6.4pseudo-1.6.4PSEUDO_1_6_4Peter Seebach2-1/+2
2015-01-22configure: handle nonexistent prefixPeter Seebach2-1/+9
The (cd $prefix; pwd) only works when the prefix already exists. Check for prefix existing before doing that.
2015-01-151.6.3pseudo-1.6.3PSEUDO_1_6_3Peter Seebach2-2/+3
2015-01-15Clean up the path allocation a bit morePeter Seebach3-46/+69
Having the same logic twice was sorta bugging me. Now the function-like-macro is sorta bugging me, and I'll just let it.
2015-01-14Make --without-passwd-fallback workPeter Seebach5-6/+83
This is derived in significant part from contributions to oe-core by Peter A. Bigot. I reworked the path routine a bit to use an already duplicated string instead of allocating copies of parts of it. The first issue was just that there was a missing antimagic() around some of the path operations. The second is that we wanted to have a way to provide a fallback password file which isn't the host's, but which can be used in the case where the target filesystem hasn't got a password yet, for bootstrapping purposes. (So there's a minimal password file that just has root, basically.) Also, I noticed a design flaw, which is that if you ended up calling pseudo_pwd_lck_open() twice in a row, the second time through, pseudo would first check whether it had a path name for the file (it does), and thus not allocate one, then call the close routine (which frees it and nulls the pointer), then open a new one... and not have a file name, so the next attempt to close it wouldn't unlink the file. This shouldn't ever come up in real code, but it was bugging me. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2015-01-05Try to handle trailing slashesPeter Seebach3-2/+39
It turns out that "a/" is equivalent to "a/.", and that in particular it should fail when a is not a directory. Pseudo's been silently stripping them and this breaks things. Attempt to fix that, lightly tested.
2014-10-03call this 1.6.2Peter Seebach2-1/+2
2014-10-03Possibly fix strange corruptionsPeter Seebach5-10/+36
Trying to track down problems which sometimes result in files showing up as nameless files, producing clashes later. Looks like there were two issues; one is we were creating links for files that we'd already found by inode. The other is that rename was sending bogus LINK messages in some cases. Also simplified the find_file_dev path to extract the path as part of the initial operation, since there wasn't any case where that wasn't being done immediately afterwards.
2014-10-03further fixups for did_unlinkPeter Seebach2-17/+20
So it turns out that the sanity checks should be skipped on did_unlink, because otherwise if an inode gets reused for a different file type, it'll get nuked. This is pretty rare, but appears to bite us occasionally during debug stripping.
2014-10-03pseudo.c: Suppress probably-spurious diagnosticsPeter Seebach2-7/+17
It turns out that, in the fairly common case where the did-unlink stuff has saved us from worse problems, pseudo produces probably-spurious error messages about the path mismatch when the did-unlink shows up. Change that into a debug message. Also fix a typo in a comment.
2014-10-02pseudo_db.c: use bind_int64 for inodesPeter Seebach2-12/+15
XFS apparently has 64-bit inodes. Our inode data path was *almost* 64-bit clean. This doesn't require a database format change because sqlite3 doesn't distinguish, but it will probably invalidate existing files.db things on XFS. But they were broken anyway.
2014-07-181.6.1pseudo-1.6.1PSEUDO_1_6_1Peter Seebach2-1/+2
2014-07-18be less chattyPeter Seebach2-1/+5
2014-07-17linux/portdefs.h: fix non-x86 buildPeter Seebach2-1/+5
The assumption that a host is either x86_64 or x86_32 does not hold well on target systems.
2014-07-11symbol version tweakspseudo-1.6.0PSEUDO_1_6_0Peter Seebach2-0/+18
We don't want to pick up newer memcpy because pseudo sometimes has to run host binaries even when built against a newer libc.
2014-07-10make xattr work on DarwinSeebs14-48/+371
More complicated, because we actually need to make com.apple stuff work probably.
2014-07-10don't pass -L/usr/libSeebs3-1/+11
The sqlite flags don't need to be present if they don't have meaningful values. I think.
2014-06-13Use constant initializer for staticPeter Seebach2-1/+2
strlen(array) isn't a constant expression, even though gcc can sometimes figure it out at compile time.
2014-06-13Don't follow symlinks for lutimes()Peter Seebach3-3/+6
Also for lstat, but that probably never matters because in Linux you will never actually call lstat without working really hard at it, because you end up calling __lxstat anyway. (Was already doing the right thing for Darwin.)
2014-05-27Typo fixPeter Seebach1-2/+2
So it turns out that if you fix a bug inside an #ifdef that hasn't applied to anything in years, it doesn't actually fix the bug.
2014-05-27add a test for umask and filesystem modesPeter Seebach2-0/+33
2014-05-27Honor umaskPeter Seebach11-1/+43
We used to rely on filesystem operations to apply the umask when appropriate, but when we started masking out 022, that stopped working. Start watching umask.
2014-05-16Mask 022 back in for database.Peter Seebach2-1/+2
PSEUDO_DB_MODE restores a proposed mode's 0700 bits, but now that we're masking 022 out, it should also restore those. Change it to restore 0722 from a proposed mode before sending to database.