command line occ add user group issue #20663

Closed
itmands opened this Issue Nov 21, 2015 · 7 comments

Projects

None yet

7 participants

@itmands
itmands commented Nov 21, 2015

Having a problem when adding a user via command line
command 'occ user:add --password-from-env --display-name="name" --group="group1" new_uid'

When the command is run to add a user and the group does not exists, it works perfectly.
When the command is run to add a user and the group exists, but has no shares, it works perfectly.
When the command is run to add a user and the group exists, but has files / folders shared to the group it adds the user, but exits with error

PHP Fatal error: Call to a member function file_exists() on null in /var/www/owncloud/lib/private/files/filesystem.php on line 688

User is created, but not added to any groups

This is running on Debian 7.9 and php 5.6. I have tested both OC 8.1.4 and 8.2.1

Both fail with the same error.

Thoughts?

@karlitschek
Member

can you post a full bug report using the issue template please? thanks

@karlitschek karlitschek added the bug label Nov 21, 2015
@itmands
itmands commented Nov 22, 2015

Sorry, using issue template

Steps to reproduce

  1. Create folder to be shared (under admin) - call it 'testfolder'
  2. Create group - DO NOT SHARE FOLDER YET - call group 'testgroup'
  3. From command line as root - export password
  4. From command line as web user - run 'occ user:add --password-from-env --display-name="testuser" --group="testgroup" --group"testgroup2" testme'
  5. From WebUI as admin, share folder 'testfolder' with group 'testgroup'
  6. From command line as web user - run 'occ user:add --password-from-env --display-name="testuser2" --group="testgroup" --group="testgroup2" testme2'
  7. From command line as web user - run 'occ user:add --password-from-env --display-name="testuser3" --group="testgroup2" --group="testgroup" testme3'

Expected behaviour

I expect to see three users created, testme, testme2 and testme3. All users should be part of groups testgroup and testgroup2. testgroup should have a shared folder called testfolder.
When I log in as testuser, testuser2 or testuser3, I should see a folder called testfolder in my files page, and all should be part of testgroup and testgroup2

Actual behaviour

At step 4, testuser is created without any problems.

At step 6, testuser2 is created with errors and is not included in any groups
output is -
"Display name set to "Fred Holmes"
PHP Fatal error: Call to a member function file_exists() on null in /var/www/owncloud/lib/private/files/filesystem.php on line 688"

At step 7, testuser3 is created with error and is only added to testgroup2 (because it comes before testgroup)

testuser is the only user included in testgroup, testuser and testuser3 are included in testgroup2. testuser2 is not included in any group.

Server configuration

Operating System
Debian 7.9 on VMSphere 5.5, 20 Gb HDD, 1 Gb RAM, 2 processors

Web server:
Apache 2.2.22 (Debian)

Database:
Mysql Ver 14.14 Distrib 5.5.46, for debian-linux-gnu (x86_64) using readline 6.2

PHP version:
PHP 5.6.15-1~dotdeb+zts+7.1

ownCloud version: (see ownCloud admin page)
version 8.2.1

Updated from an older ownCloud or fresh install:
tried both clean install and updated from version 8.1.4

List of activated apps:
Enabled:

  • activity: 2.1.3
  • calendar: 0.8.1
  • documents: 0.11.0
  • files: 1.2.0
  • files_external: 0.3.0
  • files_locking:
  • files_pdfviewer: 0.7
  • files_sharing: 0.7.0
  • files_texteditor: 2.0
  • files_trashbin: 0.7.0
  • files_versions: 1.1.0
  • files_videoviewer: 0.1.3
  • gallery: 14.2.0
  • provisioning_api: 0.3.0
  • templateeditor: 0.1
  • updater: 0.6

The content of config/config.php:

If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system --public
from within your ownCloud installation folder

 #####  returned warning 
           The "--public" option does not exist.
              #######

From command : #su -s /bin/sh www-data -c 'php occ config:list system'{
    "system": {
        "instanceid": "occkhlolvk2s",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "10.1.3.17"
        ],
        "datadirectory": "\/var\/www\/owncloud\/data",
        "overwrite.cli.url": "http:\/\/10.1.3.17\/owncloud",
        "dbtype": "sqlite3",
        "version": "8.2.1.4",
        "logtimezone": "UTC",
        "installed": true,
        "theme": "testing",
        "loglevel": 2,
        "maintenance": false,
        "trashbin_retention_obligation": "auto"
    }
}

**Are you using external storage, if yes which one:** not using external storage

**Are you using encryption:** no

**Are you using an external user-backend, if yes which one:** none, mysql only

### Client configuration
**Browser:** 
- not applicable, command line issue

**Operating system:**
- not applicable, command line issue

### Logs
#### Web server error log
- not applicable, command line issue
Insert your webserver log here
- not applicable, command line issue

#### ownCloud log (data/owncloud.log)

Only line added to log when command is run -
{"reqId":"QuPcKK1+9cYb3u5DsLjA","remoteAddr":"","app":"PHP","message":"Call to a member function file_exists() on null at /var/www/owncloud/lib/private/files/filesystem.php#688","level":3,"time":"2015-11-22T02:10:49+00:00"}

Browser log

  • not applicable, command line issue
@PVince81
Collaborator

@icewind1991 hmmm, suspicious:

PHP Fatal error: Call to a member function file_exists() on null in /var/www/owncloud/lib/private/files/filesystem.php on line 688"

is it trying to setup the FS before the user is created ?

@PVince81
Collaborator

seems to involve sharing, which makes it even more likely to be that

CC @rullzer

@PVince81 PVince81 added this to the 9.0-current milestone Nov 23, 2015
@rullzer
Contributor
rullzer commented Nov 23, 2015

I'm not sure. but I have a feeling this is causes by the check for path collision of group shares.

@schiesbn @icewind1991 can you two have a look?

@itmands
itmands commented Dec 1, 2015

Any advancement on finding a solution, and can others also confirm replication of this issue?

@pellaeon pellaeon referenced this issue in pellaeon/registration Jan 7, 2016
Closed

Problem creating the user and group #26

@PVince81 PVince81 added the sev2-high label Feb 12, 2016
@rullzer
Contributor
rullzer commented Feb 16, 2016

Ok yeah... I found the source of this issue... but it is not so trivial to fix in the current code.. basically this happens because of the old code paths that wanted to generate a new target before hand.. I'm a bit hessitant to touch this code now as hacking around this (so not target generation here)... might lead to obscure bugs in other parts...

@nickvergessen nickvergessen self-assigned this Feb 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment