From 302d77cf4a43c8e613470871615b536d10748aaa Mon Sep 17 00:00:00 2001 From: Moritz Fago Date: Tue, 19 Jun 2018 19:51:40 +0200 Subject: [PATCH] zfs: allow spaces in zfs names. Space is a allowed character in zfs names accoring to https://github.com/zfsonlinux/zfs/issues/439. --- zfs/zfs.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/zfs/zfs.go b/zfs/zfs.go index 29da261..c0541ef 100644 --- a/zfs/zfs.go +++ b/zfs/zfs.go @@ -107,8 +107,14 @@ func NewDatasetPath(s string) (p *DatasetPath, err error) { p.comps = make([]string, 0) return p, nil // the empty dataset path } - const FORBIDDEN = "@#|\t <>*" - if strings.ContainsAny(s, FORBIDDEN) { // TODO space may be a bit too restrictive... + const FORBIDDEN = "@#|\t<>*" + /* Documenation of allowed characters in zfs names: + https://docs.oracle.com/cd/E19253-01/819-5461/gbcpt/index.html + Space is missing in the oracle list, but according to + https://github.com/zfsonlinux/zfs/issues/439 + there is evidence that it was intentionally allowed + */ + if strings.ContainsAny(s, FORBIDDEN) { err = fmt.Errorf("contains forbidden characters (any of '%s')", FORBIDDEN) return }