将我的问题归结为最简单的情况,我使用Compute Engine和以下启动脚本:
#! /bin/bash
sudo useradd -m drupal
su drupal
cd /home/drupal
touch test.txt
Run Code Online (Sandbox Code Playgroud)
我可以在此命令后确认drupal用户是否存在,测试文件也是如此.但是我希望测试文件的所有者是'drupal'(因此是su).但是,当我将其用作启动脚本时,我仍然可以确认ROOT是文件的所有者:
意思是我的
su drupal
Run Code Online (Sandbox Code Playgroud)
不工作.sudo su drupal也没有任何区别.我正在使用Google Container OS,但在Debian 8图像上也是如此.
google-compute-engine google-cloud-platform containeros google-container-os
我的iOS中的核心数据有一些奇怪的问题,我似乎无法重现,它只是偶尔会发生一些报告它的用户.我从iOS崩溃报告中得到的错误:
CoreData: - [NSPersistentStoreCoordinator _coordinator_you_never_successfully_opened_the_database_so_saving_back_to_it_is_kinda_hard:] + 56
这是一个截图(省略产品名称):
困难的是我没有得到任何关于该错误的搜索结果.这是我的(相关)代码:
保存:
-(void)save
{
if(!self.horecaMOC.hasChanges)return;
NSError *error;
[self.horecaMOC save:&error];
if(error)
{
NSLog(@"save error %@",error.localizedDescription);
}
}
Run Code Online (Sandbox Code Playgroud)
商务部:
-(NSManagedObjectContext*)horecaMOC
{
if(!_horecaMOC)
{
NSPersistentStoreCoordinator *coordinator = self.horecaPSC;
if (coordinator != nil) {
_horecaMOC = [[NSManagedObjectContext alloc] init];
[_horecaMOC setPersistentStoreCoordinator:coordinator];
}
}
return _horecaMOC;
}
Run Code Online (Sandbox Code Playgroud)
PSC:
-(NSPersistentStoreCoordinator*)horecaPSC
{
if(!_horecaPSC)
{
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"horeca.sqlite"];
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
[NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption,
nil];
NSError *error = nil;
_horecaPSC = [[NSPersistentStoreCoordinator …Run Code Online (Sandbox Code Playgroud)