Trying to implement the below command but there is a type mismatch.
%fs head dbfs:/databricks-datasets/README.md 6000
Error:
notebook:1: error: type mismatch;
found : String("6000")
required: Int
println(dbutils.fs.head("dbfs:/databricks-datasets/README.md", "6000")) // SAFE COMMAND FROM MACRO
Is there no way that I can provide integer parameters at the magic command level?
There is a way. This works:
%fs head dbfs:/databricks-datasets/README.md --maxBytes=6000
Related
I got a working sequence of commands within yubihsm-shell, but cannot get the same result when calling the shell non-interactively from the command line.
In the shell I got:
yubihsm> connect
yubihsm> session open 2 MyPassword
yubihsm> set informat base64
yubihsm> set outformat hex
yubihsm> decrypt oaep 0 0x1ddd rsa-oaep-sha1 wrapped_ephemeral.txt
On the command line I have currently this (I unfortunately need to be on Windows for that, so this cmd syntax)
set YUBISHELL="c:\Program Files\Yubico\YubiHSM Shell\bin\yubihsm-shell.exe"
type wrapped_ephemeral.txt | %YUBISHELL% ^
--authkey=2 ^
--password=MyPassword ^
--algorithm=rsa-oaep-sha1 ^
--informat=base64 ^
--outformat=hex ^
--object-id=7645 ^
--action=decrypt-oaep
All I'll get is
Session keepalive set up to run every 15 seconds
Created session 0
Command not implemented: Generic error
However, connecting and authenticating works ...
%YUBISHELL% ^
--authkey=2 ^
--password=MyPassword ^
--action=get-device-info
... as I get this
Using default connector URL: http://127.0.0.1:12345
Session keepalive set up to run every 15 seconds
Version number: 2.2.0
Serial number: ........
Log used: 62/62
Supported algorithms: rsa-pkcs1-sha1, rsa-pkcs1-sha256, rsa-pkcs1-sha384,
rsa-pkcs1-sha512, rsa-pss-sha1, rsa-pss-sha256,
rsa-pss-sha384, rsa-pss-sha512, rsa2048,
rsa3072, rsa4096, ecp256,
ecp384, ecp521, eck256,
ecbp256, ecbp384, ecbp512,
hmac-sha1, hmac-sha256, hmac-sha384,
hmac-sha512, ecdsa-sha1, ecdh,
rsa-oaep-sha1, rsa-oaep-sha256, rsa-oaep-sha384,
rsa-oaep-sha512, aes128-ccm-wrap, opaque-data,
opaque-x509-certificate, mgf1-sha1, mgf1-sha256,
mgf1-sha384, mgf1-sha512, template-ssh,
aes128-yubico-otp, aes128-yubico-authentication, aes192-yubico-otp,
aes256-yubico-otp, aes192-ccm-wrap, aes256-ccm-wrap,
ecdsa-sha256, ecdsa-sha384, ecdsa-sha512,
ed25519, ecp224, rsa-pkcs1-decrypt,
The error message "Command not implemented: Generic error" is meant seriously and is not due an mistake by me.
Incomprehensibly, some commands are only available in the interactive mode of the shell.
Known Issues and Limitations
Unimplemented Commands When Invoked in Command-Line Mode
...
decrypt-oaep
...
(https://developers.yubico.com/YubiHSM2/Releases/Known_issues.html)
I had asked a quesion at kernelnewbies email list and later I thought I found the answer (I thought I can put it in my defconfig). But then later found it was my mistake. So I still have the question and I ask it here to get answer.
This is what I see when I search “KERNEL_RWX” during “make menuconfig” for arm64 kernel(5-10.0-rc5).
The Kconfig file says CONFIG_STRICT_KERNEL_RWX is for setting text and rodata read-only.
Symbol: ARCH_OPTIONAL_KERNEL_RWX [=n]
Type : bool
Defined at arch/Kconfig:928
Symbol: ARCH_OPTIONAL_KERNEL_RWX_DEFAULT [=n]
Type : bool
Defined at arch/Kconfig:931
Symbol: STRICT_KERNEL_RWX [=y]
Type : bool
Defined at arch/Kconfig:937
Prompt: Make kernel text and rodata read-only
Depends on: ARCH_HAS_STRICT_KERNEL_RWX [=y]
Visible if: ARCH_HAS_STRICT_KERNEL_RWX [=y] && ARCH_OPTIONAL_KERNEL_RWX [=n]
Location:
(1) -> General architecture-dependent options
I wanted to try setting STRICT_KERNEL_RWX to =n. The 'Visible if' descriptionn says this option is visible when ARCH_OPTIONAL_KERNEL_RWX is =y which is now =n. (The STRICT_KERNEL_RWX menu didn't appear as a configurable menu in the menuconfig at this time). This is the lines in arch/Kconfig.
config ARCH_OPTIONAL_KERNEL_RWX
def_bool n
So I modified to ARCH_OPTIONAL_KERNEL_RWX=y in arch/Kconfig line 928. (BTW, This is question : is it correct to modify this Kconfig file directly? I’m not sure at the moment)
Then I could see the STRICT_KERNEL_RWX menu in the menuconfig and I set it to =n as I wanted.
But when I build the kernel, I see this errors.
ckim#ckim-ubuntu:~/ProjX/LinuxDevDrv/kernel-release-RD-INFRA-2020.11.30$ makeit
CALL scripts/atomic/check-atomics.sh
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CC arch/arm64/mm/mmu.o
arch/arm64/mm/mmu.c: In function 'parse_rodata':
arch/arm64/mm/mmu.c:595:28: error: 'rodata_enabled' undeclared (first use in this function)
595 | int ret = strtobool(arg, &rodata_enabled);
| ^~~~~~~~~~~~~~
arch/arm64/mm/mmu.c:595:28: note: each undeclared identifier is reported only once for each function it appears in
arch/arm64/mm/mmu.c: In function 'map_entry_trampoline':
arch/arm64/mm/mmu.c:614:18: error: 'rodata_enabled' undeclared (first use in this function)
614 | pgprot_t prot = rodata_enabled ? PAGE_KERNEL_ROX : PAGE_KERNEL_EXEC;
| ^~~~~~~~~~~~~~
arch/arm64/mm/mmu.c: In function 'map_kernel':
arch/arm64/mm/mmu.c:669:23: error: 'rodata_enabled' undeclared (first use in this function)
669 | pgprot_t text_prot = rodata_enabled ? PAGE_KERNEL_ROX : PAGE_KERNEL_EXEC;
| ^~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:283: arch/arm64/mm/mmu.o] Error 1
make[1]: *** [scripts/Makefile.build:500: arch/arm64/mm] Error 2
make: *** [Makefile:1799: arch/arm64] Error 2
variable “rodata_enabled” is defined in init/main.c as below.
#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
bool rodata_enabled __ro_after_init = true;
static int __init set_debug_rodata(char *str)
{
return strtobool(str, &rodata_enabled);
}
__setup("rodata=", set_debug_rodata);
#endif
But now that CONFIG_STRICT_KERNEL_RWX=n, the above lines are not compiled here (CONFIG_STRICT_MODULE_RWX=n too). However, arch/arm64/mm/mmu.c code is still using rodata_enabled. Is this a bug of the code? Or am I missing something?
I can modify init/main.c and include/linux/init.h so that this rodata_enabled and related functions be defined regardless of these CONFIG values and make the errors go away, but I’m curious if this a kind of kernel bug raising compiler error.
So again my question is how should I change ARCH_OPTIONAL_KERNEL_RWX value? I tried setting it in my defconfig file but when I do make xxx_defonfig, the .config file shows still ARCH_OPTIONAL_KERNEL_RWX=n. Should I edit the arch/Kconfig file really?
I have the below statements in Lex.x to parse block comments.
<0> "//".* { tokWValue LTokComment }
<0> "/*" { begin blockcomment }
<blockcomment> "*/" { begin 0 }
<blockcomment> . { tokWValue LTokComment }
But If I generate Lex.hs using Alex, it does not add the 'begin' function.
This results in the below compilation error.
src/Lex.x:367:18: Not in scope: ‘begin’
src/Lex.x:368:18: Not in scope: ‘begin’
Any idea what might be wrong?
I am using wrapper 'posn'
Start codes are only available when using any of the monad-... wrappers.
If you read the docs for the monad wrapper -- Section 5.3.3 - The "monad" wrapper -- you see that it is the first wrapper which keeps track of the start code.
You can also verify this by finding the alex wrapper files -- look for the directory containing the files AlexWrapper-basic, AlexWrapper-posn, etc. On OS X when installing the Haskell Platform they are located in a directory like /Library/Haskell/ghc-7.10.2-x86_64/share/alex-3.1.4. The functions begin and andBegin only occur in the monad-related wrappers.
I'm trying to save RDD as compressed Sequence file. I'm able to save non-compressed file be calling:
counts.saveAsSequenceFile(output)
where counts is my RDD (IntWritable, Text). However, I didn't manage to compress output. I tried several configurations and always got exception:
counts.saveAsSequenceFile(output, classOf[org.apache.hadoop.io.compress.SnappyCodec])
<console>:21: error: type mismatch;
found : Class[org.apache.hadoop.io.compress.SnappyCodec](classOf[org.apache.hadoop.io.compress.SnappyCodec])
required: Option[Class[_ <: org.apache.hadoop.io.compress.CompressionCodec]]
counts.saveAsSequenceFile(output, classOf[org.apache.hadoop.io.compress.SnappyCodec])
counts.saveAsSequenceFile(output, classOf[org.apache.spark.io.SnappyCompressionCodec])
<console>:21: error: type mismatch;
found : Class[org.apache.spark.io.SnappyCompressionCodec](classOf[org.apache.spark.io.SnappyCompressionCodec])
required: Option[Class[_ <: org.apache.hadoop.io.compress.CompressionCodec]]
counts.saveAsSequenceFile(output, classOf[org.apache.spark.io.SnappyCompressionCodec])
and it doesn't work even for Gzip:
counts.saveAsSequenceFile(output, classOf[org.apache.hadoop.io.compress.GzipCodec])
<console>:21: error: type mismatch;
found : Class[org.apache.hadoop.io.compress.GzipCodec](classOf[org.apache.hadoop.io.compress.GzipCodec])
required: Option[Class[_ <: org.apache.hadoop.io.compress.CompressionCodec]]
counts.saveAsSequenceFile(output, classOf[org.apache.hadoop.io.compress.GzipCodec])
Could you please suggest solution? also, I didn't find how is it possible to specify compression parameters (i.e. compression type for Snappy)
The signature of saveAsSequenceFile is def saveAsSequenceFile(path: String, codec: Option[Class[_ <: CompressionCodec]] = None). You need to send a Option[Class[_ <: CompressionCodec]] as codec. E.g.,
counts.saveAsSequenceFile(output, Some(classOf[org.apache.hadoop.io.compress.SnappyCodec]))
If you read the error information of type mismatch carefully, you should have corrected it by yourself.
?-dynamic(setup/5).
setup :-
seeing(S),
see('people.txt'),
read_data,
write('data read'),
nl,
seen,
see(S).
read_data :-
read(A),
process(A).
process(A) :- A == end_of_file.
process(A) :-
A \== end_of_file,
write('1'),
read(B),
read(C),
read(D),
read(E),
assertz(person(A,B,C,D,E)),
read_data.
and the text are
john.will.30.london.doctor.
martha.will.33.portsea.doctor.
henry.smith.26.manchester.doctor.
the result is coming out
?- setup.
* Syntax Error
* Syntax Error
* Syntax Error
* Syntax Error
* Syntax Error
data read
yes
What happens? What did I do wrong?
You are reading with read/1 which expects valid Prolog text as input. However, your data is
john.will.30.london.doctor.
which is invalid. Write something like
person(john,will,30,london,doctor).
instead. Most often, people do not read in such data manually. Instead, they load the file with ['datafile.pl'] or other commands.