All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH e2fsprogs 00/10] case-insensitive feature updates
@ 2019-04-13  5:43 Gabriel Krisman Bertazi
  2019-04-13  5:43 ` [PATCH e2fsprogs 01/10] e2p: encoding: Fix default flags lookup Gabriel Krisman Bertazi
                   ` (8 more replies)
  0 siblings, 9 replies; 22+ messages in thread
From: Gabriel Krisman Bertazi @ 2019-04-13  5:43 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Gabriel Krisman Bertazi

Hi,

The following patches fix a few bugs on the case-insensitive
implementation on e2fsprogs, update to unicode 12.0 and implement the
design decision of not normalizing file names on directories without the
Casefold attribute.

Gabriel Krisman Bertazi (10):
  e2p: encoding: Fix default flags lookup
  ext2fs: Always attempt to load nls table when loading the filesystem
  ext2fs: nls: Convert NFKD -> NFD
  ext2fs: nls: Fix potential null dereference in utf8nlookup
  ext2fs: nls: Merge sparse fixes from the kernel version
  ext2fs: nls: Update to unicode 12.0.0
  ext2fs: Don't normalize names on -F directories
  ext2fs: nls: Drop normalization code
  ext2fs: nls: Drop ascii NLS support
  ext4.5.in: Document design changes on the casefold attribute

 e2fsck/unix.c              |   12 +-
 lib/e2p/encoding.c         |   12 +-
 lib/ext2fs/Makefile.in     |    5 +-
 lib/ext2fs/dirhash.c       |    8 +-
 lib/ext2fs/ext2_fs.h       |    5 +-
 lib/ext2fs/initialize.c    |    4 +
 lib/ext2fs/nls.h           |   10 +-
 lib/ext2fs/nls_ascii.c     |   68 -
 lib/ext2fs/nls_utf8-norm.c |   26 +-
 lib/ext2fs/nls_utf8.c      |   37 +-
 lib/ext2fs/openfs.c        |    4 +
 lib/ext2fs/utf8data.h      | 8889 ++++++++++++++----------------------
 lib/ext2fs/utf8n.h         |   14 +-
 misc/ext4.5.in             |   10 +-
 14 files changed, 3508 insertions(+), 5596 deletions(-)
 delete mode 100644 lib/ext2fs/nls_ascii.c

-- 
2.20.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH e2fsprogs 01/10] e2p: encoding: Fix default flags lookup
  2019-04-13  5:43 [PATCH e2fsprogs 00/10] case-insensitive feature updates Gabriel Krisman Bertazi
@ 2019-04-13  5:43 ` Gabriel Krisman Bertazi
  2019-04-28 19:04   ` Theodore Ts'o
  2019-04-13  5:43 ` [PATCH e2fsprogs 02/10] ext2fs: Always attempt to load nls table when loading the filesystem Gabriel Krisman Bertazi
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Gabriel Krisman Bertazi @ 2019-04-13  5:43 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Gabriel Krisman Bertazi

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
---
 lib/e2p/encoding.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/e2p/encoding.c b/lib/e2p/encoding.c
index 88433310a1dd..27e93305172b 100644
--- a/lib/e2p/encoding.c
+++ b/lib/e2p/encoding.c
@@ -67,7 +67,7 @@ int e2p_get_encoding_flags(int encoding)
 
 	for (i = 0 ; i < ARRAY_SIZE(ext4_encoding_map); i++)
 		if (ext4_encoding_map[i].encoding_magic == encoding)
-			return ext4_encoding_map[encoding].default_flags;
+			return ext4_encoding_map[i].default_flags;
 
 	return 0;
 }
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH e2fsprogs 02/10] ext2fs: Always attempt to load nls table when loading the filesystem
  2019-04-13  5:43 [PATCH e2fsprogs 00/10] case-insensitive feature updates Gabriel Krisman Bertazi
  2019-04-13  5:43 ` [PATCH e2fsprogs 01/10] e2p: encoding: Fix default flags lookup Gabriel Krisman Bertazi
@ 2019-04-13  5:43 ` Gabriel Krisman Bertazi
  2019-04-28 19:06   ` Theodore Ts'o
  2019-04-13  5:43 ` [PATCH e2fsprogs 04/10] ext2fs: nls: Fix potential null dereference in utf8nlookup Gabriel Krisman Bertazi
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Gabriel Krisman Bertazi @ 2019-04-13  5:43 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Gabriel Krisman Bertazi

fs->encoding is exposed by the library, so we need to at least try to
load it when populating ext2_filsys.  Nevertheless, failing to do so
shouldn't be a fatal error, unless the user really needs that
information.  Thus, we ignore this failure during open/initialization
and let the user who needs it validate that field before trying to use
it.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
---
 e2fsck/unix.c           | 12 ++++--------
 lib/ext2fs/initialize.c |  4 ++++
 lib/ext2fs/openfs.c     |  4 ++++
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 5b3552ece6b1..7c24f2e31e4f 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -55,7 +55,6 @@ extern int optind;
 #include "problem.h"
 #include "jfs_user.h"
 #include "../version.h"
-#include <ext2fs/nls.h>
 
 /* Command line options */
 static int cflag;		/* check disk */
@@ -1785,13 +1784,10 @@ print_unsupp_features:
 		goto get_newer;
 	}
 
-	if (ext2fs_has_feature_fname_encoding(sb)) {
-		fs->encoding = nls_load_table(sb->s_encoding);
-		if (!fs->encoding) {
-			log_err(ctx, _("%s has unsupported encoding: %0x\n"),
-				ctx->filesystem_name, sb->s_encoding);
-			goto get_newer;
-		}
+	if (ext2fs_has_feature_fname_encoding(sb) && !fs->encoding) {
+		log_err(ctx, _("%s has unsupported encoding: %0x\n"),
+			ctx->filesystem_name, sb->s_encoding);
+		goto get_newer;
 	}
 
 	/*
diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
index 30b1ae033340..2d470a070bcc 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -27,6 +27,7 @@
 
 #include "ext2_fs.h"
 #include "ext2fs.h"
+#include "nls.h"
 
 #ifndef O_BINARY
 #define O_BINARY 0
@@ -190,6 +191,9 @@ errcode_t ext2fs_initialize(const char *name, int flags,
 	assign_field(s_encoding);
 	assign_field(s_encoding_flags);
 
+	if (ext2fs_has_feature_fname_encoding(param))
+		fs->encoding = nls_load_table(param->s_encoding);
+
 	if (super->s_feature_incompat & ~EXT2_LIB_FEATURE_INCOMPAT_SUPP) {
 		retval = EXT2_ET_UNSUPP_FEATURE;
 		goto cleanup;
diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
index 85d73e2a429b..9ee6cd07f7f3 100644
--- a/lib/ext2fs/openfs.c
+++ b/lib/ext2fs/openfs.c
@@ -32,6 +32,7 @@
 
 #include "ext2fs.h"
 #include "e2image.h"
+#include "nls.h"
 
 blk64_t ext2fs_descriptor_block_loc2(ext2_filsys fs, blk64_t group_block,
 				     dgrp_t i)
@@ -502,6 +503,9 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
 		ext2fs_set_feature_shared_blocks(fs->super);
 	}
 
+	if (ext2fs_has_feature_fname_encoding(fs->super))
+		fs->encoding = nls_load_table(fs->super->s_encoding);
+
 	fs->flags &= ~EXT2_FLAG_NOFREE_ON_ERROR;
 	*ret_fs = fs;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH e2fsprogs 04/10] ext2fs: nls: Fix potential null dereference in utf8nlookup
  2019-04-13  5:43 [PATCH e2fsprogs 00/10] case-insensitive feature updates Gabriel Krisman Bertazi
  2019-04-13  5:43 ` [PATCH e2fsprogs 01/10] e2p: encoding: Fix default flags lookup Gabriel Krisman Bertazi
  2019-04-13  5:43 ` [PATCH e2fsprogs 02/10] ext2fs: Always attempt to load nls table when loading the filesystem Gabriel Krisman Bertazi
@ 2019-04-13  5:43 ` Gabriel Krisman Bertazi
  2019-04-28 19:11   ` Theodore Ts'o
  2019-04-13  5:43 ` [PATCH e2fsprogs 05/10] ext2fs: nls: Merge sparse fixes from the kernel version Gabriel Krisman Bertazi
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Gabriel Krisman Bertazi @ 2019-04-13  5:43 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Gabriel Krisman Bertazi

Delay the access of data->offset until after the null check.  This was
reported by 0-day on the kernel version of the script.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
---
 lib/ext2fs/nls_utf8-norm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/ext2fs/nls_utf8-norm.c b/lib/ext2fs/nls_utf8-norm.c
index 5a91573f766f..4230b64bc586 100644
--- a/lib/ext2fs/nls_utf8-norm.c
+++ b/lib/ext2fs/nls_utf8-norm.c
@@ -335,7 +335,7 @@ utf8hangul(const char *str, unsigned char *hangul)
 static utf8leaf_t *utf8nlookup(const struct utf8data *data,
 			       unsigned char *hangul, const char *s, size_t len)
 {
-	utf8trie_t	*trie = utf8data + data->offset;
+	utf8trie_t	*trie = NULL;
 	int		offlen;
 	int		offset;
 	int		mask;
@@ -345,6 +345,8 @@ static utf8leaf_t *utf8nlookup(const struct utf8data *data,
 		return NULL;
 	if (len == 0)
 		return NULL;
+
+	trie = utf8data + data->offset;
 	node = 1;
 	while (node) {
 		offlen = (*trie & OFFLEN) >> OFFLEN_SHIFT;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH e2fsprogs 05/10] ext2fs: nls: Merge sparse fixes from the kernel version
  2019-04-13  5:43 [PATCH e2fsprogs 00/10] case-insensitive feature updates Gabriel Krisman Bertazi
                   ` (2 preceding siblings ...)
  2019-04-13  5:43 ` [PATCH e2fsprogs 04/10] ext2fs: nls: Fix potential null dereference in utf8nlookup Gabriel Krisman Bertazi
@ 2019-04-13  5:43 ` Gabriel Krisman Bertazi
  2019-04-28 19:12   ` Theodore Ts'o
  2019-04-13  5:43 ` [PATCH e2fsprogs 07/10] ext2fs: Don't normalize names on -F directories Gabriel Krisman Bertazi
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Gabriel Krisman Bertazi @ 2019-04-13  5:43 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Gabriel Krisman Bertazi

The sparse script complained about the following issues in the kernel
version of this script.  This patch port the fixes to the userspace
version.

sparse warnings: (new ones prefixed by >>)

>> fs/unicode/utf8-norm.c:41:24: sparse: non-ANSI function declaration
   of function 'utf8version_latest'

vim +/utf8version_latest +41 fs/unicode/utf8-norm.c

  40
> 41	int utf8version_latest()
  42	{
  43		return utf8vers;
  44		}
  45	EXPORT_SYMBOL(utf8version_latest);
  46

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
---
 lib/ext2fs/nls_utf8-norm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ext2fs/nls_utf8-norm.c b/lib/ext2fs/nls_utf8-norm.c
index 4230b64bc586..27e530c14e4f 100644
--- a/lib/ext2fs/nls_utf8-norm.c
+++ b/lib/ext2fs/nls_utf8-norm.c
@@ -46,7 +46,7 @@ int utf8version_is_supported(uint8_t maj, uint8_t min, uint8_t rev)
 	return 0;
 }
 
-int utf8version_latest()
+int utf8version_latest(void)
 {
 	return utf8vers;
 }
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH e2fsprogs 07/10] ext2fs: Don't normalize names on -F directories
  2019-04-13  5:43 [PATCH e2fsprogs 00/10] case-insensitive feature updates Gabriel Krisman Bertazi
                   ` (3 preceding siblings ...)
  2019-04-13  5:43 ` [PATCH e2fsprogs 05/10] ext2fs: nls: Merge sparse fixes from the kernel version Gabriel Krisman Bertazi
@ 2019-04-13  5:43 ` Gabriel Krisman Bertazi
  2019-04-28 20:45   ` Theodore Ts'o
  2019-04-13  5:43 ` [PATCH e2fsprogs 08/10] ext2fs: nls: Drop normalization code Gabriel Krisman Bertazi
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Gabriel Krisman Bertazi @ 2019-04-13  5:43 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Gabriel Krisman Bertazi

As agreed on the new design, even if fname_encoding is enabled,
directories entries who aren't owned by a +F directory will not be
normalized.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
---
 lib/ext2fs/dirhash.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/ext2fs/dirhash.c b/lib/ext2fs/dirhash.c
index f1e7734d3865..b9afb599c0fa 100644
--- a/lib/ext2fs/dirhash.c
+++ b/lib/ext2fs/dirhash.c
@@ -281,15 +281,11 @@ errcode_t ext2fs_dirhash2(int version, const char *name, int len,
 	int dlen;
 	unsigned char *buff;
 
-	if (len && charset) {
+	if (len && charset && (hash_flags & EXT4_CASEFOLD_FL)) {
 		char buff[PATH_MAX];
 
-		if (hash_flags & EXT4_CASEFOLD_FL)
-			dlen = charset->ops->casefold(charset, name, len, buff,
+		dlen = charset->ops->casefold(charset, name, len, buff,
 						      sizeof(buff));
-		else
-			dlen = charset->ops->normalize(charset, name, len, buff,
-						       sizeof(buff));
 		if (dlen < 0) {
 			if (dlen == -EINVAL)
 				goto opaque_seq;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH e2fsprogs 08/10] ext2fs: nls: Drop normalization code
  2019-04-13  5:43 [PATCH e2fsprogs 00/10] case-insensitive feature updates Gabriel Krisman Bertazi
                   ` (4 preceding siblings ...)
  2019-04-13  5:43 ` [PATCH e2fsprogs 07/10] ext2fs: Don't normalize names on -F directories Gabriel Krisman Bertazi
@ 2019-04-13  5:43 ` Gabriel Krisman Bertazi
  2019-04-28 20:48   ` Theodore Ts'o
  2019-05-02 16:25   ` Change feature name from fname_encoding to casefold? Theodore Ts'o
  2019-04-13  5:43 ` [PATCH e2fsprogs 09/10] ext2fs: nls: Drop ascii NLS support Gabriel Krisman Bertazi
                   ` (2 subsequent siblings)
  8 siblings, 2 replies; 22+ messages in thread
From: Gabriel Krisman Bertazi @ 2019-04-13  5:43 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Gabriel Krisman Bertazi

No longer necessary after +F design change.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
---
 lib/e2p/encoding.c     |  3 +--
 lib/ext2fs/ext2_fs.h   |  2 --
 lib/ext2fs/nls.h       |  4 ----
 lib/ext2fs/nls_ascii.c | 20 --------------------
 lib/ext2fs/nls_utf8.c  | 31 -------------------------------
 5 files changed, 1 insertion(+), 59 deletions(-)

diff --git a/lib/e2p/encoding.c b/lib/e2p/encoding.c
index 23470bdf38a5..62e0aada92c2 100644
--- a/lib/e2p/encoding.c
+++ b/lib/e2p/encoding.c
@@ -36,8 +36,7 @@ static const struct {
 	{
 		.encoding_magic = EXT4_ENC_UTF8_12_0,
 		.name = "utf8",
-		.default_flags = (EXT4_UTF8_NORMALIZATION_TYPE_NFKD |
-				  EXT4_UTF8_CASEFOLD_TYPE_NFKDCF)
+		.default_flags = 0,
 	},
 };
 
diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
index a1edc54dfd52..80ff02265ee5 100644
--- a/lib/ext2fs/ext2_fs.h
+++ b/lib/ext2fs/ext2_fs.h
@@ -1132,7 +1132,5 @@ struct mmp_struct {
 #define EXT4_ENC_UTF8_12_0	1
 
 #define EXT4_ENC_STRICT_MODE_FL			(1 << 0) /* Reject invalid sequences */
-#define EXT4_UTF8_NORMALIZATION_TYPE_NFKD	(1 << 1)
-#define EXT4_UTF8_CASEFOLD_TYPE_NFKDCF		(1 << 4)
 
 #endif	/* _LINUX_EXT2_FS_H */
diff --git a/lib/ext2fs/nls.h b/lib/ext2fs/nls.h
index c4fcbcb32528..ae56aa9abc89 100644
--- a/lib/ext2fs/nls.h
+++ b/lib/ext2fs/nls.h
@@ -33,10 +33,6 @@ struct nls_table;
         (sizeof(array) / sizeof(array[0]))
 
 struct nls_ops {
-	int (*normalize)(const struct nls_table *charset,
-			 const unsigned char *str, size_t len,
-			 unsigned char *dest, size_t dlen);
-
 	int (*casefold)(const struct nls_table *charset,
 			const unsigned char *str, size_t len,
 			unsigned char *dest, size_t dlen);
diff --git a/lib/ext2fs/nls_ascii.c b/lib/ext2fs/nls_ascii.c
index 5d513df404c1..cc03fea97ec5 100644
--- a/lib/ext2fs/nls_ascii.c
+++ b/lib/ext2fs/nls_ascii.c
@@ -39,28 +39,8 @@ static int ascii_casefold(const struct nls_table *table,
 	return len;
 }
 
-static int ascii_normalize(const struct nls_table *table,
-			   const unsigned char *str, size_t len,
-			   unsigned char *dest, size_t dlen)
-{
-	int i;
-
-	if (dlen < len)
-		return -ENAMETOOLONG;
-
-	for (i = 0; i < len; i++) {
-		if (str[i] & 0x80)
-			return -EINVAL;
-
-		dest[i] = str[i];
-	}
-
-	return len;
-}
-
 const static struct nls_ops ascii_ops = {
 	.casefold = ascii_casefold,
-	.normalize = ascii_normalize,
 };
 
 const struct nls_table nls_ascii = {
diff --git a/lib/ext2fs/nls_utf8.c b/lib/ext2fs/nls_utf8.c
index 426657764fc6..b1698e3c409f 100644
--- a/lib/ext2fs/nls_utf8.c
+++ b/lib/ext2fs/nls_utf8.c
@@ -54,39 +54,8 @@ invalid_seq:
 	return -EINVAL;
 }
 
-static int utf8_normalize(const struct nls_table *table,
-			  const unsigned char *str, size_t len,
-			  unsigned char *dest, size_t dlen)
-{
-	const struct utf8data *data = utf8nfdi(table->version);
-	struct utf8cursor cur;
-	ssize_t nlen = 0;
-
-	if (utf8ncursor(&cur, data, str, len) < 0)
-		goto invalid_seq;
-
-	for (nlen = 0; nlen < dlen; nlen++) {
-		dest[nlen] = utf8byte(&cur);
-		if (!dest[nlen])
-			return nlen;
-		if (dest[nlen] == -1)
-			break;
-	}
-
-	return -ENAMETOOLONG;
-
-invalid_seq:
-	if (dlen < len)
-		return -ENAMETOOLONG;
-
-	/* Signal invalid sequence */
-	return -EINVAL;
-}
-
 const static struct nls_ops utf8_ops = {
 	.casefold = utf8_casefold,
-	.normalize = utf8_normalize,
-
 };
 
 const struct nls_table nls_utf8_12_0 = {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH e2fsprogs 09/10] ext2fs: nls: Drop ascii NLS support
  2019-04-13  5:43 [PATCH e2fsprogs 00/10] case-insensitive feature updates Gabriel Krisman Bertazi
                   ` (5 preceding siblings ...)
  2019-04-13  5:43 ` [PATCH e2fsprogs 08/10] ext2fs: nls: Drop normalization code Gabriel Krisman Bertazi
@ 2019-04-13  5:43 ` Gabriel Krisman Bertazi
  2019-04-28 20:52   ` Theodore Ts'o
  2019-04-13  5:43 ` [PATCH e2fsprogs 10/10] ext4.5.in: Document design changes on the casefold attribute Gabriel Krisman Bertazi
       [not found] ` <20190413054317.7388-4-krisman@collabora.com>
  8 siblings, 1 reply; 22+ messages in thread
From: Gabriel Krisman Bertazi @ 2019-04-13  5:43 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Gabriel Krisman Bertazi

As agreed on the kernel side, ext4 will only support utf8 for now, and
not plain ascii, so we don't need this anymore.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
---
 lib/e2p/encoding.c     |  5 -----
 lib/ext2fs/Makefile.in |  5 ++---
 lib/ext2fs/ext2_fs.h   |  1 -
 lib/ext2fs/nls.h       |  2 --
 lib/ext2fs/nls_ascii.c | 48 ------------------------------------------
 5 files changed, 2 insertions(+), 59 deletions(-)
 delete mode 100644 lib/ext2fs/nls_ascii.c

diff --git a/lib/e2p/encoding.c b/lib/e2p/encoding.c
index 62e0aada92c2..6a3c472b1b31 100644
--- a/lib/e2p/encoding.c
+++ b/lib/e2p/encoding.c
@@ -28,11 +28,6 @@ static const struct {
 	__u16 default_flags;
 
 } ext4_encoding_map[] = {
-	{
-		.encoding_magic = EXT4_ENC_ASCII,
-		.name = "ascii",
-		.default_flags = 0
-	},
 	{
 		.encoding_magic = EXT4_ENC_UTF8_12_0,
 		.name = "utf8",
diff --git a/lib/ext2fs/Makefile.in b/lib/ext2fs/Makefile.in
index 06c2394b34b8..4b3fc1881cff 100644
--- a/lib/ext2fs/Makefile.in
+++ b/lib/ext2fs/Makefile.in
@@ -20,8 +20,8 @@ COMPILE_ET=	_ET_DIR_OVERRIDE=$(srcdir)/../et ../et/compile_et
 @TEST_IO_CMT@TEST_IO_LIB_OBJS = test_io.o
 @IMAGER_CMT@E2IMAGE_LIB_OBJS = imager.o
 
-NLS_OBJS=nls_ascii.o nls_utf8-norm.o nls_utf8.o
-NLS_SRCS=$(srcdir)/nls_ascii.c $(srcdir)/nls_utf8-norm.c $(srcdir)/nls_utf8.c
+NLS_OBJS=nls_utf8-norm.o nls_utf8.o
+NLS_SRCS=$(srcdir)/nls_utf8-norm.c $(srcdir)/nls_utf8.c
 
 DEBUG_OBJS= debug_cmds.o extent_cmds.o tst_cmds.o debugfs.o util.o \
 	ncheck.o icheck.o ls.o lsdel.o dump.o set_fields.o logdump.o \
@@ -1328,7 +1328,6 @@ do_journal.o: $(top_srcdir)/debugfs/do_journal.c $(top_builddir)/lib/config.h \
  $(top_srcdir)/lib/support/quotaio_tree.h $(srcdir)/kernel-jbd.h \
  $(srcdir)/jfs_compat.h $(srcdir)/kernel-list.h \
  $(top_srcdir)/debugfs/journal.h $(srcdir)/../../e2fsck/jfs_user.h
-nls_ascii.o: $(srcdir)/nls_ascii.c $(srcdir)/nls.h $(srcdir)/ext2_fs.h
 nls_utf8-norm.o: $(srcdir)/nls_utf8-norm.c $(srcdir)/utf8n.h \
  $(srcdir)/utf8data.h
 nls_utf8.o: $(srcdir)/nls_utf8.c $(srcdir)/nls.h $(srcdir)/ext2_fs.h \
diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
index 80ff02265ee5..fc8a650a3aad 100644
--- a/lib/ext2fs/ext2_fs.h
+++ b/lib/ext2fs/ext2_fs.h
@@ -1128,7 +1128,6 @@ struct mmp_struct {
  */
 #define EXT4_INLINE_DATA_DOTDOT_SIZE	(4)
 
-#define EXT4_ENC_ASCII		0
 #define EXT4_ENC_UTF8_12_0	1
 
 #define EXT4_ENC_STRICT_MODE_FL			(1 << 0) /* Reject invalid sequences */
diff --git a/lib/ext2fs/nls.h b/lib/ext2fs/nls.h
index ae56aa9abc89..f008bd167f36 100644
--- a/lib/ext2fs/nls.h
+++ b/lib/ext2fs/nls.h
@@ -43,14 +43,12 @@ struct nls_table {
 	const struct nls_ops *ops;
 };
 
-extern const struct nls_table nls_ascii;
 extern const struct nls_table nls_utf8_12_0;
 
 static const struct {
 	int encoding_magic;
 	const struct nls_table *tbl;
 } nls_map[] = {
-	{ EXT4_ENC_ASCII, &nls_ascii },
 	{ EXT4_ENC_UTF8_12_0, &nls_utf8_12_0 },
 };
 
diff --git a/lib/ext2fs/nls_ascii.c b/lib/ext2fs/nls_ascii.c
deleted file mode 100644
index cc03fea97ec5..000000000000
--- a/lib/ext2fs/nls_ascii.c
+++ /dev/null
@@ -1,48 +0,0 @@
-#include "nls.h"
-
-#include <errno.h>
-#include <string.h>
-
-
-static unsigned char charset_tolower(const struct nls_table *table,
-				     unsigned int c)
-{
-	if (c >= 'A' && c <= 'Z')
-		return (c | 0x20);
-	return c;
-}
-
-static unsigned char charset_toupper(const struct nls_table *table,
-				     unsigned int c)
-{
-	if (c >= 'a' && c <= 'z')
-		return (c & ~0x20);
-	return c;
-}
-
-static int ascii_casefold(const struct nls_table *table,
-			  const unsigned char *str, size_t len,
-			  unsigned char *dest, size_t dlen)
-{
-	int i;
-
-	if (dlen < len)
-		return -ENAMETOOLONG;
-
-	for (i = 0; i < len; i++) {
-		if (str[i] & 0x80)
-			return -EINVAL;
-
-		dest[i] = charset_toupper(table, str[i]);
-	}
-
-	return len;
-}
-
-const static struct nls_ops ascii_ops = {
-	.casefold = ascii_casefold,
-};
-
-const struct nls_table nls_ascii = {
-	.ops = &ascii_ops,
-};
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH e2fsprogs 10/10] ext4.5.in: Document design changes on the casefold attribute
  2019-04-13  5:43 [PATCH e2fsprogs 00/10] case-insensitive feature updates Gabriel Krisman Bertazi
                   ` (6 preceding siblings ...)
  2019-04-13  5:43 ` [PATCH e2fsprogs 09/10] ext2fs: nls: Drop ascii NLS support Gabriel Krisman Bertazi
@ 2019-04-13  5:43 ` Gabriel Krisman Bertazi
  2019-04-29  1:00   ` Theodore Ts'o
       [not found] ` <20190413054317.7388-4-krisman@collabora.com>
  8 siblings, 1 reply; 22+ messages in thread
From: Gabriel Krisman Bertazi @ 2019-04-13  5:43 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Gabriel Krisman Bertazi

Document the fact that the encoding support is only used by directories
with the +F attribute.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
---
 misc/ext4.5.in | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/misc/ext4.5.in b/misc/ext4.5.in
index ee5e170979a1..2a8ce1e2f8e8 100644
--- a/misc/ext4.5.in
+++ b/misc/ext4.5.in
@@ -154,12 +154,10 @@ option.
 .B fname_encoding
 .br
 This ext4 feature provides file system level character encoding support
-for files and directories name.  This feature is name-preserving on the
-disk, but it allows applications to lookup for a file in the file system
-using any encoding equivalent version of the file name.
-
-This feature is required to perform in-kernel case-insensitive file
-name lookups.
+for directories with the casefold (+F) flag enabled.  This feature is
+name-preserving on the disk, but it allows applications to lookup for a
+file in the file system using an encoding equivalent version of the file
+name.
 .TP
 .B has_journal
 .br
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH e2fsprogs 01/10] e2p: encoding: Fix default flags lookup
  2019-04-13  5:43 ` [PATCH e2fsprogs 01/10] e2p: encoding: Fix default flags lookup Gabriel Krisman Bertazi
@ 2019-04-28 19:04   ` Theodore Ts'o
  0 siblings, 0 replies; 22+ messages in thread
From: Theodore Ts'o @ 2019-04-28 19:04 UTC (permalink / raw)
  To: Gabriel Krisman Bertazi; +Cc: linux-ext4

On Sat, Apr 13, 2019 at 01:43:08AM -0400, Gabriel Krisman Bertazi wrote:
> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>

Thanks, applied.

					- Ted

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH e2fsprogs 02/10] ext2fs: Always attempt to load nls table when loading the filesystem
  2019-04-13  5:43 ` [PATCH e2fsprogs 02/10] ext2fs: Always attempt to load nls table when loading the filesystem Gabriel Krisman Bertazi
@ 2019-04-28 19:06   ` Theodore Ts'o
  0 siblings, 0 replies; 22+ messages in thread
From: Theodore Ts'o @ 2019-04-28 19:06 UTC (permalink / raw)
  To: Gabriel Krisman Bertazi; +Cc: linux-ext4

On Sat, Apr 13, 2019 at 01:43:09AM -0400, Gabriel Krisman Bertazi wrote:
> fs->encoding is exposed by the library, so we need to at least try to
> load it when populating ext2_filsys.  Nevertheless, failing to do so
> shouldn't be a fatal error, unless the user really needs that
> information.  Thus, we ignore this failure during open/initialization
> and let the user who needs it validate that field before trying to use
> it.
> 
> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>

Thanks, applied.

					- Ted

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH e2fsprogs 03/10] ext2fs: nls: Convert NFKD -> NFD
       [not found] ` <20190413054317.7388-4-krisman@collabora.com>
@ 2019-04-28 19:09   ` Theodore Ts'o
  0 siblings, 0 replies; 22+ messages in thread
From: Theodore Ts'o @ 2019-04-28 19:09 UTC (permalink / raw)
  To: Gabriel Krisman Bertazi; +Cc: linux-ext4

On Sat, Apr 13, 2019 at 01:43:10AM -0400, Gabriel Krisman Bertazi wrote:
> Following the kernel transition, convert the normalization format from
> NFKD to NFD.  This also regenerates the utf8data.h database.
> 
> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>

Thanks, applied.

						- Ted

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH e2fsprogs 04/10] ext2fs: nls: Fix potential null dereference in utf8nlookup
  2019-04-13  5:43 ` [PATCH e2fsprogs 04/10] ext2fs: nls: Fix potential null dereference in utf8nlookup Gabriel Krisman Bertazi
@ 2019-04-28 19:11   ` Theodore Ts'o
  0 siblings, 0 replies; 22+ messages in thread
From: Theodore Ts'o @ 2019-04-28 19:11 UTC (permalink / raw)
  To: Gabriel Krisman Bertazi; +Cc: linux-ext4

On Sat, Apr 13, 2019 at 01:43:11AM -0400, Gabriel Krisman Bertazi wrote:
> Delay the access of data->offset until after the null check.  This was
> reported by 0-day on the kernel version of the script.
> 
> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>

Applied, thanks.

						- Ted

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH e2fsprogs 05/10] ext2fs: nls: Merge sparse fixes from the kernel version
  2019-04-13  5:43 ` [PATCH e2fsprogs 05/10] ext2fs: nls: Merge sparse fixes from the kernel version Gabriel Krisman Bertazi
@ 2019-04-28 19:12   ` Theodore Ts'o
  0 siblings, 0 replies; 22+ messages in thread
From: Theodore Ts'o @ 2019-04-28 19:12 UTC (permalink / raw)
  To: Gabriel Krisman Bertazi; +Cc: linux-ext4

On Sat, Apr 13, 2019 at 01:43:12AM -0400, Gabriel Krisman Bertazi wrote:
> The sparse script complained about the following issues in the kernel
> version of this script.  This patch port the fixes to the userspace
> version.
> 
> sparse warnings: (new ones prefixed by >>)
> 
> >> fs/unicode/utf8-norm.c:41:24: sparse: non-ANSI function declaration
>    of function 'utf8version_latest'
> 
> vim +/utf8version_latest +41 fs/unicode/utf8-norm.c
> 
>   40
> > 41	int utf8version_latest()
>   42	{
>   43		return utf8vers;
>   44		}
>   45	EXPORT_SYMBOL(utf8version_latest);
>   46
> 
> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>

Thanks, applied.

						- Ted

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH e2fsprogs 07/10] ext2fs: Don't normalize names on -F directories
  2019-04-13  5:43 ` [PATCH e2fsprogs 07/10] ext2fs: Don't normalize names on -F directories Gabriel Krisman Bertazi
@ 2019-04-28 20:45   ` Theodore Ts'o
  0 siblings, 0 replies; 22+ messages in thread
From: Theodore Ts'o @ 2019-04-28 20:45 UTC (permalink / raw)
  To: Gabriel Krisman Bertazi; +Cc: linux-ext4

On Sat, Apr 13, 2019 at 01:43:14AM -0400, Gabriel Krisman Bertazi wrote:
> As agreed on the new design, even if fname_encoding is enabled,
> directories entries who aren't owned by a +F directory will not be
> normalized.
> 
> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>

Thanks, applied.

						- Ted

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH e2fsprogs 08/10] ext2fs: nls: Drop normalization code
  2019-04-13  5:43 ` [PATCH e2fsprogs 08/10] ext2fs: nls: Drop normalization code Gabriel Krisman Bertazi
@ 2019-04-28 20:48   ` Theodore Ts'o
  2019-05-02 16:25   ` Change feature name from fname_encoding to casefold? Theodore Ts'o
  1 sibling, 0 replies; 22+ messages in thread
From: Theodore Ts'o @ 2019-04-28 20:48 UTC (permalink / raw)
  To: Gabriel Krisman Bertazi; +Cc: linux-ext4

On Sat, Apr 13, 2019 at 01:43:15AM -0400, Gabriel Krisman Bertazi wrote:
> No longer necessary after +F design change.
> 
> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>

Thanks, applied.

						- Ted

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH e2fsprogs 09/10] ext2fs: nls: Drop ascii NLS support
  2019-04-13  5:43 ` [PATCH e2fsprogs 09/10] ext2fs: nls: Drop ascii NLS support Gabriel Krisman Bertazi
@ 2019-04-28 20:52   ` Theodore Ts'o
  0 siblings, 0 replies; 22+ messages in thread
From: Theodore Ts'o @ 2019-04-28 20:52 UTC (permalink / raw)
  To: Gabriel Krisman Bertazi; +Cc: linux-ext4

On Sat, Apr 13, 2019 at 01:43:16AM -0400, Gabriel Krisman Bertazi wrote:
> As agreed on the kernel side, ext4 will only support utf8 for now, and
> not plain ascii, so we don't need this anymore.
> 
> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>

Thanks, applied.

						- Ted

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH e2fsprogs 10/10] ext4.5.in: Document design changes on the casefold attribute
  2019-04-13  5:43 ` [PATCH e2fsprogs 10/10] ext4.5.in: Document design changes on the casefold attribute Gabriel Krisman Bertazi
@ 2019-04-29  1:00   ` Theodore Ts'o
  0 siblings, 0 replies; 22+ messages in thread
From: Theodore Ts'o @ 2019-04-29  1:00 UTC (permalink / raw)
  To: Gabriel Krisman Bertazi; +Cc: linux-ext4

On Sat, Apr 13, 2019 at 01:43:17AM -0400, Gabriel Krisman Bertazi wrote:
> Document the fact that the encoding support is only used by directories
> with the +F attribute.
> 
> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>

Thanks, applied.

						- Ted

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Change feature name from fname_encoding to casefold?
  2019-04-13  5:43 ` [PATCH e2fsprogs 08/10] ext2fs: nls: Drop normalization code Gabriel Krisman Bertazi
  2019-04-28 20:48   ` Theodore Ts'o
@ 2019-05-02 16:25   ` Theodore Ts'o
  2019-05-02 17:03     ` Gabriel Krisman Bertazi
  2019-05-02 20:50     ` Darrick J. Wong
  1 sibling, 2 replies; 22+ messages in thread
From: Theodore Ts'o @ 2019-05-02 16:25 UTC (permalink / raw)
  To: Gabriel Krisman Bertazi; +Cc: linux-ext4

Given how we've simplified how we handle Unicode --- in particular,
not doing any kind of normalization unless we are doing case-folding
compares, I think it will be more user-friendly if we rename the
feature from fname_encoding to casefold.

What do you think?  Any objections?

					- Ted

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Change feature name from fname_encoding to casefold?
  2019-05-02 16:25   ` Change feature name from fname_encoding to casefold? Theodore Ts'o
@ 2019-05-02 17:03     ` Gabriel Krisman Bertazi
  2019-05-02 20:50     ` Darrick J. Wong
  1 sibling, 0 replies; 22+ messages in thread
From: Gabriel Krisman Bertazi @ 2019-05-02 17:03 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-ext4

"Theodore Ts'o" <tytso@mit.edu> writes:

> Given how we've simplified how we handle Unicode --- in particular,
> not doing any kind of normalization unless we are doing case-folding
> compares, I think it will be more user-friendly if we rename the
> feature from fname_encoding to casefold.
>
> What do you think?  Any objections?

I don't object at all, but I'll need to update some test
packages/documentation already published to customers in order to change
it. So I'd need a final decision to be taken quickly on it. :)

-- 
Gabriel Krisman Bertazi

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Change feature name from fname_encoding to casefold?
  2019-05-02 16:25   ` Change feature name from fname_encoding to casefold? Theodore Ts'o
  2019-05-02 17:03     ` Gabriel Krisman Bertazi
@ 2019-05-02 20:50     ` Darrick J. Wong
  2019-05-02 21:46       ` Gabriel Krisman Bertazi
  1 sibling, 1 reply; 22+ messages in thread
From: Darrick J. Wong @ 2019-05-02 20:50 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Gabriel Krisman Bertazi, linux-ext4

On Thu, May 02, 2019 at 12:25:27PM -0400, Theodore Ts'o wrote:
> Given how we've simplified how we handle Unicode --- in particular,
> not doing any kind of normalization unless we are doing case-folding
> compares, I think it will be more user-friendly if we rename the
> feature from fname_encoding to casefold.

TBH /me hadn't done enough reviewing even to notice the feature was
named 'fname_encoding' (whatever that means -- encoded how?).
IMHO 'casefold' is more descriptive about what the feature provides
(folding case for directory name comparisons, right?)

--D

> 
> What do you think?  Any objections?
> 
> 					- Ted

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Change feature name from fname_encoding to casefold?
  2019-05-02 20:50     ` Darrick J. Wong
@ 2019-05-02 21:46       ` Gabriel Krisman Bertazi
  0 siblings, 0 replies; 22+ messages in thread
From: Gabriel Krisman Bertazi @ 2019-05-02 21:46 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Theodore Ts'o, linux-ext4

"Darrick J. Wong" <darrick.wong@oracle.com> writes:

> On Thu, May 02, 2019 at 12:25:27PM -0400, Theodore Ts'o wrote:
>> Given how we've simplified how we handle Unicode --- in particular,
>> not doing any kind of normalization unless we are doing case-folding
>> compares, I think it will be more user-friendly if we rename the
>> feature from fname_encoding to casefold.
>
> TBH /me hadn't done enough reviewing even to notice the feature was
> named 'fname_encoding' (whatever that means -- encoded how?).
> IMHO 'casefold' is more descriptive about what the feature provides
> (folding case for directory name comparisons, right?)
>

This name was accurate until the v6 of the patches.  In v7, we decided
to no longer apply file name encoding normalization system-wide during
lookups, which changed the semantics of this feature flag.  By that
time, though, the name was already committed to e2fsprogs, so i didn't
bother to change it.

-- 
Gabriel Krisman Bertazi

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2019-05-02 21:46 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-13  5:43 [PATCH e2fsprogs 00/10] case-insensitive feature updates Gabriel Krisman Bertazi
2019-04-13  5:43 ` [PATCH e2fsprogs 01/10] e2p: encoding: Fix default flags lookup Gabriel Krisman Bertazi
2019-04-28 19:04   ` Theodore Ts'o
2019-04-13  5:43 ` [PATCH e2fsprogs 02/10] ext2fs: Always attempt to load nls table when loading the filesystem Gabriel Krisman Bertazi
2019-04-28 19:06   ` Theodore Ts'o
2019-04-13  5:43 ` [PATCH e2fsprogs 04/10] ext2fs: nls: Fix potential null dereference in utf8nlookup Gabriel Krisman Bertazi
2019-04-28 19:11   ` Theodore Ts'o
2019-04-13  5:43 ` [PATCH e2fsprogs 05/10] ext2fs: nls: Merge sparse fixes from the kernel version Gabriel Krisman Bertazi
2019-04-28 19:12   ` Theodore Ts'o
2019-04-13  5:43 ` [PATCH e2fsprogs 07/10] ext2fs: Don't normalize names on -F directories Gabriel Krisman Bertazi
2019-04-28 20:45   ` Theodore Ts'o
2019-04-13  5:43 ` [PATCH e2fsprogs 08/10] ext2fs: nls: Drop normalization code Gabriel Krisman Bertazi
2019-04-28 20:48   ` Theodore Ts'o
2019-05-02 16:25   ` Change feature name from fname_encoding to casefold? Theodore Ts'o
2019-05-02 17:03     ` Gabriel Krisman Bertazi
2019-05-02 20:50     ` Darrick J. Wong
2019-05-02 21:46       ` Gabriel Krisman Bertazi
2019-04-13  5:43 ` [PATCH e2fsprogs 09/10] ext2fs: nls: Drop ascii NLS support Gabriel Krisman Bertazi
2019-04-28 20:52   ` Theodore Ts'o
2019-04-13  5:43 ` [PATCH e2fsprogs 10/10] ext4.5.in: Document design changes on the casefold attribute Gabriel Krisman Bertazi
2019-04-29  1:00   ` Theodore Ts'o
     [not found] ` <20190413054317.7388-4-krisman@collabora.com>
2019-04-28 19:09   ` [PATCH e2fsprogs 03/10] ext2fs: nls: Convert NFKD -> NFD Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.